如何强制SGEN创建.NET 3.5串行总成 [英] How to force Sgen to create .net 3.5 serializers assembly

查看:182
本文介绍了如何强制SGEN创建.NET 3.5串行总成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的.NET 3.5库SGEN生成步骤。在VS2010这个生成.NET 4 MyLib.XmlSerializers.dll,它不能从.NET 3.5的应用程序加载。有谁知道如何改变生成步骤来获得组件的正常版本?是否有可能合并IL装配序列化器和库成一个DLL?

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 change build step to get correct version of the assembly? Is it possible to IL merge serializers assembly and library into single dll?

这是我的SGEN构建步骤:

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

编辑:我已经找到同样的问题这里 ,但我会等待一段时间,看看是否有人有一个更好的解决方案。

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

推荐答案

您可以使用.NET 3.5 sgen.exe

You could use the .NET 3.5 sgen.exe:

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

您将需要确保包含要 SGEN 是针对.NET 3.5的类型的程序集。

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

这篇关于如何强制SGEN创建.NET 3.5串行总成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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