Question

I want to remove AssemblyInfo.cpp, because of some metadata errors that sometimes come up.

Is AssemblyInfo.cpp useful for anything? Or can it be removed without any problem?

Was it helpful?

Solution

I've discovered one distinction for this file: it has to do with values reported under calls to Assembly.GetReferencedAssemblies. I was working on tracking version numbers of our binaries from our SVN repository by embedding the revision numbers into them. Initially I too was updating AssemblyInfo.cpp and found nothing reported in the file property details tab for the binary. It seemed this file did nothing for me in terms of updating those details, which was not the case with similar updates to a csproj's AssemblyInfo.cs. Why the difference right?

Now in one such csproj we happen to reference a vcxproj and that csproj dumps to a log the versions of all its referenced assemblies using the .NET Assembly.GetReferencedAssemblies method. What I discovered was that the number that was being reported in that log was not the vcxproj's version as given by the VS_VERSIONINFO resource I added (which does get the version details into the file properties details tab). Instead the number reported was actually matching that defined in the AssemblyInfo.cpp.

So for vcxproj files it looks like VS_VERSIONINFO is capable of updating the contents you find under the file properties details tab but AssemblyInfo.cpp is capable of exposing the version to GetReferencedAssemblies. In C# these two areas of reporting seem to be unified. Maybe there's a way to direct AssemblyInfo.cpp to propagate into the file details in some fashion, but what I'm going to wind up doing is duplicating the build info to both locations in a prebuild step. Maybe someone can find a better approach.

OTHER TIPS

So far I never had the AssemblyInfo.cpp in my managed c++ dlls, so I don't think it is necessary.

(I just added the file to have version information for my c++ dlls).

Why not just fix the errors? On that note, what errors are you getting?

This file provides information such as a version number which is definitely needed in order to use the assembly you have built.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top