Why doesn't Visual Studio 2005 create an Xml Serialization assembly?

Why doesn't Visual Studio 2005 create a serialization parameter when I set the project parameter “Generate serialization assembly” to “On”?

+3
source share
2 answers

It turns out that Dev Studio respects this setting only for web services.

For non-web services, you can get this to work by adding an AfterBuild target to the 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:

+9
source

This can be done manually using sgen.exe .

+1
source

Source: https://habr.com/ru/post/1697540/


All Articles