2

I am attempting to solve the well known problem of automatically generated serialization assemblies in VS 2010, both VB.NET and C#. The "Generate Serialization Assemblies" option in project settings does nothing for non-web projects (see http://blog.devstone.com/aaron/archive/2008/02/07/2778.aspx et al). Thus the calls to serializers generate file i/o exceptions that are very unfortunate, and for which there is no cure. The method suggested above does not appear to work with VS2010 and SGEN still runs with /proxytypes enabled.

Zachary Schuessler
  • 3,644
  • 2
  • 28
  • 43
alexkai
  • 61
  • 6

1 Answers1

4

Solution:

Set "Generate Serialization Assemblies" in project settings to ON as usual, then add this xml into the .proj file:

<PropertyGroup>
    <SGenUseProxyTypes>false</SGenUseProxyTypes>
    <SGenPlatformTarget>$(Platform)</SGenPlatformTarget>
</PropertyGroup>

The first line turns off the evil /proxytypes switch. The second line is required if the platform that is selected is anything other than AnyCPU. If it is omitted, then the serialization assembly is built with AnyCPU and will fail to bind to the main assembly that may be x86 or x64.

alexkai
  • 61
  • 6
  • +1 This was very helpful! One thing that is a bit concerning for us is that we have projects that generate serialization assemblies and we do not specify the SGenPlatformTarget. Yet the x86 platform specifier is included in the assembly rather than AnyCPU, not sure why that is happening. Any insight would be great alexkai – Daniel McQuiston Jan 08 '13 at 21:08