XML Serializer Generator Tool (Sgen.exe) to generate 64-bit Windows DLL?

2.1k views Asked by At

I am building a 64-bit C# .NET DLL in Visual Studio 2010. My project's post-build steps include the running of sgen.exe to generate a corresponding XmlSerializer DLL for my assembly. (I'm trying to load a CLR function into SQL Server 2012. The function does some XML serializing.)

Is there a way to generate 64-bit code with any version of sgen.exe? Or is there a particular Windows SDK that I should install? Can't seem to find a download site.

2

There are 2 answers

1
Raman Zhylich On

You can pass C# compiler options in /c parameter:

sgen.exe /c:/platform:x64

But not sure it makes sense for MSIL

2
Iridium On

The XML serialization assembly built by sgen should be built as AnyCPU, and so will run in 32bit on x86, and 64bit on x64. Is there a reason you need to force it to x64?