How to get Sgen to create a .net 3.5 serializer assembly

I have a sgen build step in my .NET 3.5 library. In VS2010, this creates the .NET 4 MyLib.XmlSerializers.dll, which cannot be downloaded from .NET 3.5 applications. Does anyone know how to change the build step to get the correct build version? Is it possible for IL to combine assembly serializers and libraries into a 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 found the same question here , but I'll wait a while to find out if anyone has a better solution.

+2
c # visual-studio-2010 sgen
source share
1 answer

You can use .NET 3.5 sgen.exe :

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

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

+4
source share

All Articles