7

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?

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
Bastianon Massimo
  • 1,710
  • 1
  • 16
  • 23
  • The "proper" way would be to have 1 WPF project per application, all of them share everything but what needs to be different. If done right, you can add a new, independent build in a couple of minutes. Not providing an answer because it would be way too long for SO – Alex Dec 24 '14 at 10:13
  • @Alex if I knew this thing, I might organize differently the projects, but after several years of developing is too hard to organize everything – Bastianon Massimo Dec 24 '14 at 10:20

1 Answers1

6

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.

Ondrej Janacek
  • 12,486
  • 14
  • 59
  • 93
  • Yes this might be one solutions, but i have to complile (and obfuscate) twice. I hoped there was a faster solution.. – Bastianon Massimo Dec 24 '14 at 09:41
  • @BastianonMassimo I don't think you can go any other way. Assembly info (or manifest) is written to an assembly during compilation is is part of it. Also I think there's some hash that describes all the metadata in the assembly and if you change something in it after compilation, it will get corrupted in order to protect consumers. – Ondrej Janacek Dec 24 '14 at 09:51
  • It will be much more painful every release.. dammit – Bastianon Massimo Dec 24 '14 at 10:12
  • @BastianonMassimo It will only take mome time, but once you set those directives, it should not require any additional maintenance. – Ondrej Janacek Dec 24 '14 at 10:17
  • I'm quite sad because making new releases takes me a lot of time. And now I have to repeat all steps twice (build, obfuscate, setup, testing) and hope everything goes right at the first attempt. Thanks for your help :-) – Bastianon Massimo Dec 24 '14 at 10:29