在我的.NET 3.5库中有一个sgen构建步骤。在VS2010中,这会生成无法从.NET 3.5应用程序加载的.NET 4 MyLib.XmlSerializers.dll。有谁知道如何更改构建步骤来获得正确的程序集版本吗?IL是否可以将序列化程序集和库合并到单个dll中?
这是我的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="$(SGenToolPath)">
<Output TaskParameter="SerializationAssembly" ItemName="SerializationAssembly" />
</SGen>
</Target>谢谢
编辑:我已经找到了相同的问题here,但我会等待一段时间,看看是否有人有更好的解决方案。
发布于 2010-07-28 15:39:22
您可以使用.NET 3.5 sgen.exe
ToolPath="C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin"您需要确保包含您想要sgen的类型的程序集以.NET 3.5为目标。
https://stackoverflow.com/questions/3350780
复制相似问题