3

I would like to change the text shown in the screenshot below based on the Product name. I know, the text is taken from Assembly.Title property which is a read only property and so can not be changed at runtime. So how do I change it at compile time? We sell the application to multiple customers and the name of the application should change per customer. We have a configurations for each customer. So at build time, Assembly title should be selected as per the configuration.

enter image description here

Any suggestion how to solve this?

Update:

I tried some of the suggestions given in the comments and I found following:

After I set the text using the assembly info popup from project properties or by changing it directly in the AssemblyInfo.cs file, it is shown correctly in the taskbar.

If I change it again, changed text is not shown in the taskbar ie. it shows all the time the text which was set at FIRST time.

I tried deleting files, even restarting the system, but it didn't help.

Then I renamed the file (i.e. exe file) and then it showed correctly the changed text.

If I rename it back to original name, it shows the first set text.

What could be the reasons?

Rajesh Naik
  • 407
  • 8
  • 17
  • Possible what you are looking for: http://stackoverflow.com/questions/3585444/how-can-i-change-assemblyproduct-assemblytitle-using-msbuild – Håkan Fahlstedt Jan 27 '14 at 12:16

1 Answers1

3

In AssemblyInfo.cs (under Properties in a VisualStudio project), you'll find the assembly title specified in an attribute like this:

[assembly: AssemblyTitle("MyAssembly")]

You should be able to wrap this with compiler constants:

#if SOME_MODE
    [assembly: AssemblyTitle("SomeName")]
#else
    [assembly: AssemblyTitle("ADifferentName")]
#endif
ChaseMedallion
  • 20,860
  • 17
  • 88
  • 152
  • Potentially, the OP wants to separate code from build type so that the process can be controlled solely from script. This is a bulletproof way to switch on build config though! – Gusdor Jan 27 '14 at 12:33
  • 1
    @Gusdor Unless AssemblyInfo.cs is treated differently, the compiler directive should handle this. The `SOME_MODE` constant can be associated with the desired configuration in the project properties view. – nmclean Jan 27 '14 at 13:14
  • @ChaseMedallion I tried but it is not changing, please check my updated question. – Rajesh Naik Jan 27 '14 at 13:36
  • 1
    @RajeshNaik: it could be that the windows UI just caches the assembly title for display in the jump list. However, since you are sending different versions of the application to different customers this shouldn't be an issue, right? To confirm, try sending the differently-titled version to another machine and check that the right title is displayed there. – ChaseMedallion Jan 27 '14 at 18:02