I have a c# proyect that I need to change its product name upon compiling. I used the prebuild event to change it in the AssemblyInfo.cs but a few times visual studio doesnt get this change and compiles it with the previous product name. So i prefer to change it after compiling from another executable (all in c#)
A:
Once the assembly is compiled, you can't (or at least shouldn't) change that information. It's compiled into a resource file inside the assembly that's not designed to be changed.
Visual Studio should always pull that information in, because it's part of the code. If it's not, that may be a sign of a bigger problem, because Visual Studio is not compiling the code you expect to be compiled, and there may be rogue versions of other code files being included as well. Try doing a complete Rebuild Solution, and make sure that the product name is then correct; if not, move the code to a different machine and compile it there, just to make sure it's not pulling in files from somewhere else on your machine for some reason.
Mike Mooney
2010-02-17 13:02:31
Its changing the same value before or after compiling it. Simply visual studio promps for reloading the data from the cs file and becouse i do it at compile time (precompile event) it doesnt always get the changes...In the end i only want to know how to change the exe throught c#...not to go the hard way....
ase69s
2010-02-17 14:48:09
The topic Mike is refering to in his post (very correct) is that if you sign the assembly (required for placement in GAC and such) you are ´tampering´ with an signed assembly by changing any bit in the compiled binary.This might actually be a more difficult route to walk than making the change up front, in a way that works according to your wishes.
Marvin Smit
2010-02-17 20:26:11
In this case im not signing it so there is no problem about that
ase69s
2010-02-18 07:48:48