本文介紹了在構建期間自動化 xsd.exe的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我需要一種在構建過程中根據 *.xsd 文件自動重新生成 *.cs 文件的方法,最好不涉及任何自定義加載項.這也需要在 CI 構建上運行.
I need a way to automatically regenerate *.cs files during build, based on *.xsd files, preferably without involving any custom add-ins. This needs to run on the CI build as well.
我不確定我是否遺漏了一些明顯的東西,或者在我看來這真的很棘手嗎?
I'm not sure if I'm missing something obvious, or is this really tricky as it seems to me?
推薦答案
我用這個腳本:
@echo off
cd %1
call :treeProcess %2 "XSDs"
cd ..
goto :eof
:treeProcess
rem From http://stackoverflow.com/a/8398621/298754
echo Processing %2
for %%f in (*.xsd) do call :buildXSD %%f %1 %2 %%~nf
for /D %%d in (*) do (
cd %%d
call :treeProcess %1 %2.%%d
cd ..
)
exit /b
:buildXSD
%2 %1 /c /n:%3.%4%
帶有預構建事件
call "$(ProjectDir)"XSDBuilder.bat "$(ProjectDir)"XSDs "$(Registry:HKEY_LOCAL_MACHINESOFTWAREMicrosoftMicrosoft SDKsWindowsv7.0A@InstallationFolder)binxsd.exe"
這將遞歸解析項目根目錄中名為 XSDs
的文件夾中的每個 .xsd 文件,并根據文件夾結構分配命名空間.
This will recursively parse every .xsd file in a folder in the project root called XSDs
, and will assign a namespace based on the folder structure.
這篇關于在構建期間自動化 xsd.exe的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!