Question

I'm working with VS2008 and VS2010 for different projects simultaneously. Recently I tried to generate the serialization assemblies for the Entities Project and was unable to generate the same via visual studio 2010. This throws up the below error:

An attempt was made to load an assembly with an incorrect format: X:\Dev\Proj\X.Entities\bin\Debug\X.entities.dll.

This is be post build event I have setup for the Entities project

"$(FrameworkSDKDir)\Bin\sgen" /nologo /force $(TargetFileName)
copy "$(TargetDir)X.Entities.Serializer.dll" "$(SolutionDir)\X.Site\Bin"

I'm able to generate the Serializer dll from the VS 2010 command line. For the VS2008 projects; the lines are working fine. However, the errors are on the VS2010 projects!

Is there a different FrameworkSDKDir variable for VS2010? if not, how do I modify it to work with both VS2010 and VS2008 projects?

BTW, I use win 2008 Server 32-bit OS, IIS 7 for the development.

Was it helpful?

Solution

sgen that you are pointing to is for CLR 2.0. Ideally it will be located at C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin.

There is a 4.0 version of sgen under "C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools" which resolves the issue.

Your post build command should start like this:

"$(FrameworkSDKDir)\bin\NETFX 4.0 Tools\sgen"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top