0

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.

Buggieboy
  • 4,636
  • 4
  • 55
  • 79

2 Answers2

3

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

sgen.exe /c:/platform:x64

But not sure it makes sense for MSIL

Raman Zhylich
  • 3,537
  • 25
  • 23
  • Thanks for that. I was missing the ":" between "/c" and "/platform". I still am having trouble building a C# user-defined function (UDF) DLL and accompanying XML serializer DLL on a 64-bit box that will work in SQL 2012. (Works fine if I build them on a 32-bit box.) – Buggieboy Aug 01 '12 at 22:11
1

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?

Iridium
  • 23,323
  • 6
  • 52
  • 74
  • Yes. It's because I'm trying to do this http://support.microsoft.com/kb/913668 , which loads an XmlSerializers DLL into SQL 2012 on a 64-bit CPU. – Buggieboy Aug 01 '12 at 22:05
  • @Buggieboy because the serialization assemblies are built as AnyCPU, they can be loaded and run natively on both 32 and 64 bit machines. The DLL contains only MSIL, which is then JITted into the appropriate x86 or x64 instructions depending on what architecture it's loaded on. – Iridium Aug 02 '12 at 07:00