开发者

How to force Sgen to create .net 3.5 serializers assembly

I have a sgen build step in my .NET 3.5 library. In VS2010 this generates .NET 4 MyLib.XmlSerializers.dll, which cannot be loaded from .NET 3.5 apps. Does anyone know how to chang开发者_JAVA技巧e build step to get correct version of the assembly? Is it possible to IL merge serializers assembly and library into single dll?

This is my sgen build step:

<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>

Thanks

EDIT: I have found the same question here, but I'll wait for a while to see if someone has a better solution.


You could use the .NET 3.5 sgen.exe:

ToolPath="C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin"

You will need to make sure that the assembly containing the type you want to sgen is targeting .NET 3.5.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜