栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

生成Xml序列化程序集作为我的构建的一部分

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

生成Xml序列化程序集作为我的构建的一部分

这是通过修改.CSPROJ文件中的MSBUILD脚本来设法做到的:

首先,将.CSPROJ文件作为文件而不是作为项目打开。滚动到文件底部,直到在Project标记关闭之前找到以下注释掉的代码:

<!-- To modify your build process, add your task inside one of the targets below and uncomment it. Other similar extension points exist, see Microsoft.Common.targets.<Target Name="BeforeBuild"></Target><Target Name="AfterBuild"></Target>-->

现在,我们只需插入自己的AfterBuild目标即可删除我们自己的所有现有XmlSerializer和SGen,如下所示:

<Target Name="AfterBuild" DependsonTargets="AssignTargetPaths;Compile;ResolveKeySource" Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)" Outputs="$(OutputPath)$(_SGenDllName)">   <!-- Delete the file because I can't figure out how to force the SGen task. -->   <Delete     Files="$(TargetDir)$(TargetName).XmlSerializers.dll"     ContinueOnError="true" />   <SGen     BuildAssemblyName="$(TargetFileName)"     BuildAssemblyPath="$(OutputPath)"     References="@(ReferencePath)"     ShouldGenerateSerializer="true"     UseProxyTypes="false"     KeyContainer="$(KeyContainerName)"     KeyFile="$(KeyOriginatorFile)"     DelaySign="$(DelaySign)"     ToolPath="$(TargetframeworkSDKToolsDirectory)"     Platform="$(Platform)">      <Output       TaskParameter="SerializationAssembly"       ItemName="SerializationAssembly" />   </SGen></Target>

这对我行得通。



转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/378283.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号