Renaming the .NET 2.0 executable

Does anyone know of any errors when changing the name of the C # .NET 2.0 executable in the post build event, given that the executable has a strong name and has a built-in manifest? In addition, the executable will be signed by a third party before being packaged by the installer.

I know that any related .config files also need to be renamed to reflect the new executable file name.

Am I also right in assuming that the best solution is to change the assembly name in the project properties rather than renaming the executable file name? The problem is that Visual Studio does not play well with assembly conditional names. (i.e. adding a condition attribute to a tag in .csproj)

+4
source share
2 answers

VS loads the project once and then saves it in memory. If you want to build two assemblies from VS, you can add an AfterBuild target and call MSBuild to build the assembly again, but with different parameters:

<ProperttyGroup Condition="'$(BuildAgain)'==''"> <!-- Default parameters to VS --> <AssemblyName>Name1,Default</AssemblyName> <ProperttyGroup> <ProperttyGroup Condition="'$(BuildAgain)'=='true'"> <!-- Overrided parameters --> <AssemblyName>Name2.Custom</AssemblyName> <ProperttyGroup> <Target Name="AfterBuild" Condition="'$(BuildAgain)'==''"> <MSBuild Projects="$(MSBuildProjectFullPath)" Properties="BuildAgain=true;Configuration=$(Configuration);Platform=$(Platform)" Targets="Rebuild" </Target> 
+2
source

There is no real benefit to strong naming exe. The advantage of strong dll naming is that someone cannot replace it with their own version of malware (and you can put it in the GAC). If you are not referencing your exe in another project, as if it were a dll (which would be strange), you do not need a strong name.

+1
source

Source: https://habr.com/ru/post/1342277/


All Articles