C# projects, proper versioning, company, etc on deployment
My company is working towards moving our development from C++.net into C#. Our product has standard monthly release (for instance, 5.0.19.2...).
In in C++.net, we had a common app.rc file, that standardized the company info, as well as version number. Since every project within the solution would include the same app.rc file once, it was very easy to change the version info on over 200 projects.
How does this solution translate into the C# world? The questions that I checked before writing this mention it through the property window in the solution explorer, but that is not w开发者_C百科hat I want.
I know the assemblyinfo.cs contains the information I want to modify, but I don't think I could have one master file. Do I need to split it up into multiple files?
Thanks in advance!
You can add a file as a link instead of the actual file. E.g, my solution could be:
Solution
- My Project
- Properties
- AssemblyInfo.cs
- SharedAssemblyInfo.cs (Linked)
- Solution Items
- SharedAssemblyInfo.cs
When you add an existing item to the solution, you can use the drop down arrow on the Add
link, and select Add as Link
. The SharedAssemblyInfo.cs
file can contain common/shared assembly attributes, e.g.:
[assembly: AssemblyVersion("2.0.*")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyCompany("My Company")]
... etc. The project local can contain project specific attributes:
[assembly: AssemblyTitle("My Assembly")]
... etc.
It's a common practice in c# solutions to comment out version information in the assemblyinfo.cs of each project and then have a single common "shared_assemblyinfo.cs" (named to taste) that contains version information and is shared across all projects...
You can have one assembly info file and only specify the assembly version in it:
using System;
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")]
Then, you just add the file as a link to each of your other projects (you'll have to remove the AssemblyVersion attribute from each of the Properties\AssemblyInfo.cs
files by hand though). When they build, they'll all use this file.
A master assembly.cs is possible - simply delete your project's assembly.cs file, and re-add a master assembly.cs to every project with the "As a Link" option in the "Add File" dialog.
http://www.tigraine.at/2009/01/22/sharing-a-common-assemblyinfo-between-projects-in-a-solution/
I would suggest to have version information for every project, considering that they are 400 or could be so big, it's extremely important to know on every new big setup which versions of assemblies make part of that setup. Every assembly developed by different person(s) like a separate projects and finally they finished in one big mosaic of your main app, with it's MainVersion.
Regards.
精彩评论