生成过程中自动XSD.EXE [英] Automate xsd.exe during build

查看:159
本文介绍了生成过程中自动XSD.EXE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一种方法构建过程中自动重新生成*的.cs文件的基础上,* xsd文件,preferably不涉及任何自定义加载项。这需要对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%

用的prebuild事件

with a prebuild event of

call "$(ProjectDir)"XSDBuilder.bat "$(ProjectDir)"\XSDs "$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A\@InstallationFolder)bin\xsd.exe"

这将递归解析的文件夹中的每个.xsd文件在项目的根名为的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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆