If I set the assembly version number for a C# DLL in Visual Studio 2008, is it possible to have the compiled binary automatically include this version number in the file name? If I manually rename the file, projects that reference it break. Why is that? Does the file name somehow map to the assembly name inside?
+2
A:
The assembly name is the name of the file, and for assemblies that don't have a strong name it is the only way that the CLR can load the assembly from disk. When you change the assembly name, your application can no longer find the assembly to load so the application fails.
As for auto-generating the version number in the assembly name, you won't be able to do this from Visual Studio but it isn't impossible using an MSBuild build script to do it. I would advise you not to do this though since version information is already stored in the assembly's manifest and most folks will not trust the version number in the file name (since this may not be accurate) and will check the manifest anyways.
Andrew Hare
2009-10-19 23:02:51