SGEN doesn't work after upgrading from VS2008 to VS2010

后端 未结 2 1114
滥情空心
滥情空心 2020-12-20 20:11

I just recently upgraded a VS2008/.NET 3.5 SP1 project to VS2010 and .NET 4. I have a post-build event which calls SGEN to generate the XmlSerializers assembly.

When

相关标签:
2条回答
  • 2020-12-20 21:02

    Yes, there are two versions of sgen.exe available, one for CLR v2 assemblies, the other for CLR v4 assemblies. It bombs because you ask the v2 version of sgen.exe to process a v4 assembly.

    Check how your project gets sgen.exe started. If it is a post-build event then you'll have to tweak the path to sgen.exe. I don't see a macro or environment variable to get it right automatically, bit of an oversight.

    0 讨论(0)
  • 2020-12-20 21:07

    Seems like that second line of output from SGEN is important:

    [Microsoft (R) .NET Framework, Version 2.0.50727.3038]
    

    I found another version of SGEN which seems to work at C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\sgen.exe. It outputs this when you run it:

    [Microsoft (R) .NET Framework, Version 4.0.30319.1]
    

    I'm not sure why both are included in the Windows 7 SDK...

    0 讨论(0)
提交回复
热议问题