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

时间:2023-01-06 11:48:44

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

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

2 个解决方案

#1


9  

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

事实证明,Dev Studio仅尊重Web服务的此设置。

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

对于非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>

See also:

#2


1  

It can be done manually with sgen.exe.

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

#1


9  

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

事实证明,Dev Studio仅尊重Web服务的此设置。

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

对于非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>

See also:

#2


1  

It can be done manually with sgen.exe.

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