Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change application name, icon and assembly info after compilation

I have to distribute a software with 2 different names and, obviously, with different assembly information, such as name, descriptions, company etc.

I'm focusing to find the easy way to handle this huge problem by only changing the compiled EXE name/icon/etc.

Changing icon is not a problem, I found an easy post compilation script. But I cant find any article about changing assembly infos.

  • I tried with Mono.Cecil but the resulting exe is always corrupted
  • I tried to create a new wpf project extending the original App class but it wont start because of resources not found and others errors
  • I read thousands of articles but none helped me..

Have you got any tips for me? or at least a new ways to go?

like image 755
Bastianon Massimo Avatar asked Dec 24 '14 08:12

Bastianon Massimo


1 Answers

Try using preprocessor directives in AssemblyInfo.cs like following

#if XYZ
[assembly: AssemblyTitle("NameXYZ")]
#elif ABC
[assembly: AssemblyTitle("NameABC")]
#endif

Then simply build your app with two different configurations (ABC, XYZ).

As I understand it, assembly descriptors are part of metadata that are written to an assembly during compilation and can't be easily (there may be a way) changed afterwards in order to protect consumers of the assembly against someone who might tinker with it.

like image 103
Ondrej Janacek Avatar answered Oct 24 '22 02:10

Ondrej Janacek