SGEN doesn't work after upgrading from VS2008 to VS2010 - visual-studio-2010

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.
Whenever I try to run it I get the following error.
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\sgen.exe" /debug /force /verbose /c:"platform:x86" "C:\path\to\SomeAssembly.dll"
Microsoft (R) Xml Serialization support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.3038]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: An attempt was made to load an assembly with an incorrect format: c:\path\to\someassembly.dll.
- Could not load file or assembly 'file:///c:\path\to\someassembly.dll'
or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.
If you would like more help, please type "sgen /?".
I get the same error running SGEN from the command line, but I can't figure out what the problem is. Any ideas?

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...

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.

Related

Error while using msbuild command for sln file

I am trying to build a sln file by using following command
/c/Windows/Microsoft.NET/Framework/v4.0.30319/MSBuild.exe "MvcApplication1/MvcApplication1.sln" /t:MvcApplication
It id throwing me following error:
Microsoft (R) Build Engine version 4.7.2053.0
[Microsoft .NET Framework, version 4.0.30319.42000]
Copyright (C) Microsoft Corporation. All rights reserved.
MSBUILD : error MSB1008: Only one project can be specified.
Switch: t:MvcApplication
For switch syntax, type "MSBuild /help"
But when i am trying to use the same command without any argument it is building successfully on my default target.
I don't know where it publishing my web and why it is not taking any of the argument.

Building WiX on Visual Studio Team Services times out

I have an existing XAML build I am porting over to Visual Studio Team Services build. There is a Solution file that contains two wixproj projects, and this builds with no issues on the current (legacy XAML) Hosted Build Controller (which uses WiX Toolset v3.7).
In VS TS, I created a new build process and added a step to Build solution using a Visual Studio Build step. I have set the Solution path to my sln that contains the two wixproj projects. All the other options are the defaults except the timeout which is set to 10 minutes.
The build step initiates but times out after calling the Light.exe step, as in the log below:
PrepareForBuild:
Creating directory "obj\Debug\".
Creating directory "bin\Debug\".
Compile:
C:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe -dDebug ...
Windows Installer XML Toolset Compiler version 3.10.3.3007
Copyright (c) .NET Foundation and contributors. All rights reserved.
{myfile}.wxs
Link:
C:\Program Files (x86)\WiX Toolset v3.10\bin\Light.exe -out ...
Windows Installer XML Toolset Linker version 3.10.3.3007
Copyright (c) .NET Foundation and contributors. All rights reserved.
##[error]The task has timed out.
The build will run 10 minutes and then throw a timeout error. It usually takes ~1 minute to finish. There is no information in the log about where this may be timing out or why.
I see that VS TS Build uses WiX version 3.10, but WiX version 3.10 works for me locally to build this same sln. I haveve tried all options for Visual Studio Version in the build step with same results.
Any ideas what I am missing and why this isn't working?
I found a post in the wixtoolset GitHub project documenting a bug in WiX 3.10 about deadlocks occurring with WiX projects if there are any warning or error messages generated during the build.
The workaround is to add the following MSBuild Arguments in the build step:
/p:RunWixToolsOutOfProc=true
This resolved my issue with the Light.exe process timing out.
Files (x86)\WiX Toolset v3.10\bin\candle.exe -dDebug ...
Windows Installer XML Toolset Compiler version 3.10.3.3007
Copyright (c) .NET Foundation and contributors. All rights reserved.
{myfile}.wxs
Link:
C:\Program Files (x86)\WiX Toolset v3.10\bin\Light.exe -out ...
Windows Installer XML Toolset

installer error (windows 7 / vs2010)

When the installer reaches the point of trying to "tie in" to Visual Studio 2010, ends up generating an error.
Error running C:\Program Files\PlasticSCM5/client/tools/regpkg.exe
/root:Software\Micosoft\VisualStudio\10.0 /codebase "C:\Program
Files\PlasticSCM5/client/plasticVSextensibility.dll": regpkgL error:
Could not load file or assembly 'file:///C:\Program
Files\PlasticSCM5\client\plasticVSextensibility.dll' or one of its
dependencies. This assembly is built by a runtime newer than the
currently loaded runtime and cannot be loaded.
Machine:
Windows 7 SP1, 64bit
Visual Studio 2010 Professional SP1Rel
Microsoft .NET Framework 4.5.50709 SP1 (and 3.5 and 4.0 installed)
Anyway, this prevents me from getting the "Source Control" option for Plastic SCM in VS.
Anybody got a solution for this ?
Thanks in advance!

OpenCL: Strong name validation failed while creating a new opencl project

This is the OpenCL first tutorial I am following.
I am unable to create new OpenCL project. When I try to create new OpenCL project in visual studio 2010 on windows 7, 64 bit , I get "Strong name validation failed. (Exception from HRESULT: 0x8013141A)" error. And thus it fails to create new project.
Reading some forum says, I have to do some thing with the dll . But I have no idea what is being said.
Some advice is at :http://www.lookout.net/2006/04/bypassing-strong-name-verification-for.html which ask me to do this:
sn -Vr *,36e4ce08b8ecfb17
But what do I put for 36e4ce08b8ecfb17, this is the name of the assembly, but what is the name of the assembly in my case? I am facing this issue at the beginning, when I just try to create New OpenCL project.
Can some one give me a hint specific to OpenCL ?
Then I click OK , and I get this:
What I tried
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>sn -Vl
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Assembly/Strong Name Users
===========================================
*,* All users
iisresolver,B03F5F7F11D50A3A All users
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>sn -Vr * ,B03F5F7F11D50A3
A
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Failed to open registry key -- Unable to format error message 00000005
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>sn -Vr iisresolver , B03F
5F7F11D50A3A
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Failed to open metadata scope on iisresolver -- The system cannot find the file
specified.
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>sn -Vr * , *
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Failed to open registry key -- Unable to format error message 00000005
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>
After I used elevated permission of CMD
C:\Windows\system32>sn -Vr * ,B03F5F7F11D50A3A
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Verification entry added for assembly '*,B03F5F7F11D50A3A'
No gain here , so tired this:
C:\Windows\system32>sn -Vr * ,*
Microsoft (R) .NET Framework Strong Name Utility Version 4.0.30319.1
Copyright (c) Microsoft Corporation. All rights reserved.
Verification entry added for assembly '*,*'
C:\Windows\system32>
Unfortunately no gain.
this is an annoying issue that can easily be sidestepped for development purposes.
To disable the strong name validating, simply open the visual studio command-line (for example, in Windows 7: Start >> All Programs >> Microsoft Visual Studio 2010 >> Visual Studio Tools >> Visual Studio Command Prompt (2010) )
Then type sn -Vl which will return you a list of all the assemblies registered for strong name validation.
Then type sn -Vr *,idnumberhere to disable the strong name validation for that assembly.
In the case of the error you are receiving ( Failed to open registry key -- Unable to format error message 00000005), this is most often related to permissions: your username may not have the necessary permissions to change strong name validation hence change the permissions on C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA to allow full access to your username as well and all should be fine again:)
Also, ensure that you run the VS command-line with elevated privileges so select Run as Administrator.
Hope this helps. :)
Let me know if you need more information as well though:)
This error is probably due to error Windows Registry try to modify it
or
install Intel or AMD OpenCL SDK on your machine, try to create the project again
or Update the include and library paths of the project to load the required information from the OpenCL SDK installed
I had this same exact problem today, and unfortunately, wasn't able to get it to work using sn.exe.
However, a workaround that worked for me was to just use one of Intel's sample programs as a starting project, and modify it from there. (For example the basic capabilities sample)

Microsoft.ReportView.ProcessingObjectModel Version 8.0.0.0 - Visual Studio 2005-2010

I have a program that was built in Visual Studio 2005. However, this program does not run on Windows 7 machine. I converted the project from Visual Studio 2005 to Visual Studio 2010. I then copied the published files to a Windows 7 laptop and ran the executable from there. When doing so, I got the following error:
Unable to install or run the application. The application requires that assembly Microsoft.ReportView.ProcessingObjectModel Version 8.0.0.0 be installed in the GAC first
Most of the solutions that I have found are for Visual Studio 8. Anybody have an answer?
I was able to resolve this by removing the Microsoft.ReportView.ProcessingObjectModel Version 8.0.0.0 from the assembly and adding 10.0.0.0 instead.

Resources