Reputation: 1369
I have a C#/WPF app. I am trying to create different versions that will ship to different customers with their branding. The branding is currently in the AssemblyInfo.cs, an icon, splash screen, exe name.
I thought I could create separate project configurations and then I thought I could just create separate AssemblyInfo.cs files for each customer.
But the project seems to only allow one assemblyinfo and does not allow this to be changed on a per configuration basis (e.g. it is the first tab in the Project Properties dialog).
Is a better way to somehow put the AssemblyInfo.cs info in a resource and then have multiple resource files, one for each customer, and have separate configurations that link in the different resource?
I was hoping then as I continued development, I could develop under the native branding and then just Batch Build all the release builds to produce the exes for each customer.
Any help or suggestions on how I can make a maintainable solution would be great.
Upvotes: 0
Views: 128
Reputation: 49974
The AssemblyInfo.cs
file, while being a class file, doesn't actually have any class information in it, by default it simply contains attributes. You can use conditional compilation symbols around these attributes:
#if MY_SYMBOL
[assembly: AssemblyTitle("Tim's Magical Application")]
#else
[assembly: AssemblyTitle("Some Other Name")]
#endif
you can also use your own custom attributes in there.
But the project seems to only allow one assemblyinfo
This file resides in the Properties folder of the project. You can also have another .cs file sitting beside it with another list of attributes in it (i.e. AssemblyInfo.custom.cs). Any entries you change via the project properties dialog are reflected in the original AssemblyInfo.cs file, leaving your custom one untouched.
So if you decide to use attributes in the AssemblyInfo.cs to control the customer specific branding then you have a couple of ways to do it. Personally though I would have a neutral image loosely packaged, and use either my build process or installer build to include the appropriate branding images in the distributable package (replacing the neutral image).
Upvotes: 2