为什么Visual Studio 2005不会生成Xml序列化程序集?

时间:2008-09-25 21:02:49

标签: visual-studio-2005 xml-serialization sgen

当我将项目设置“Generate Serialization Assembly”设置为“On”时,为什么Visual Studio 2005不生成序列化设置?

2 个答案:

答案 0 :(得分:9)

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

对于非Web服务,您可以通过向项目文件添加AfterBuild目标来实现此目的:

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

另见:

答案 1 :(得分:1)

可以使用sgen.exe手动完成。