Monday, October 17, 2011

Strong Name Utility Message: "x.dll does not represent a strongly named assembly"

We are in the process of migrating our code base from Visual Studio 2008 to Visual Studio 2010. To give you an indication for the size of the effort: Our product consists of multiple solutions most of them being pure C#. One of the solutions, however, contains about 70 projects most of which are C++ with a mix of both managed and unmanaged C++. Some of these projects were originally created in the 90s and upgraded multiple times to Visual Studio 2008. We are talking about over 1 million lines of C++ code.
To prepare for the actual upgrade we have a code branch separate to trunk. In this separate branch we run test upgrades on a regular basis. For a successful upgrade we need to eliminate all build errors that are reported after the migration. In addition to this we also endeavor to resolve all warnings although we are aware that we may not be able to resolve them completely.
Today I came across this warning/error message today in Visual Studio 2010 SP1 (Service Pack 1). While building I ran into a bug that was reported for Visual Studio 2010 and that was supposed to be fixed in SP1. Signing a C++/CLI assembly in VS 2008 worked but is broken in VS2010. A work around has been provided for both VS2010 and VS2010 SP1.
When I used this work around it worked like a charm for one project but failed for the next project. In my view this indicated that there had to be at least one other factor that influences the outcome.
I used a diff tool to compare both project files (*.vcxproj) to see differences in the compiler and linker options but also to eliminate these differences one at a time. In my particular case I found that I was able to resolve the problem by removing the ‘/clr’ from the project settings and instead applying ‘/clr’ to each file source file (*.cpp) that requires individually.
Update: It some cases switching off incremental linking seems to help.
(Disclaimer: This solution may not work in all cases.)

0 comments:

Post a Comment

All comments, questions and other feedback is much appreciated. Thank you!