Automate xsd.exe during build(在构建期间自动化 xsd.exe)
问题描述
我需要一种在构建过程中根据 *.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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:在构建期间自动化 xsd.exe


基础教程推荐
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01