Question

Why isn't Visual Studio 2005 generating a serialization setting when I set the project setting "Generate Serialization Assembly" to "On"?

Was it helpful?

Solution

It turns out that Dev Studio only honors this setting for Web Services.

For non-web services you can get this to work by adding an AfterBuild target to your project file:

  <Target Name="AfterBuild" DependsOnTargets="AssignTargetPaths;Compile;ResolveKeySource" Inputs="$(MSBuildAllProjects);@(IntermediateAssembly)"  Outputs="$(OutputPath)$(_SGenDllName)">         
      <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>

See also:

OTHER TIPS

It can be done manually with sgen.exe.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top