make the assemblyversion similar to publish version
how do i make the [assembly: AssemblyVersion("1.0.*")] in the assemblyInfo.cs f开发者_开发知识库or aboutbox to be similar with the publish version at the project property?
currently it seem that i have to enter twice.. i refered to this link example, and i don get the result as expected..
Use ApplicationDeployment.CurrentDeployment.CurrentVersion to get the Publish version
Just comment out the line:
[assembly: AssemblyFileVersion("1.0.0.0")]
in AssemblyInfo.cs file. So, two last lines of that file will be:
[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyFileVersion("1.0.0.0")]
Rebuild the project and your Assembly version and the .dll file version will be identical.
The answer as it appeared in 2011
You can modify the AssemblyInfo.cs file. This exists per project. In recent Visual Studio versions it may be nested under "properties" visual studio folder under the project.
Go to your project, expand that, go to "Properties", expand that, open the "AssemblyInfo.cs" file.
Most likely you'll see it end with:
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
So, you can change the attributes.
Update (February 2011)
Also check:
StackOverflow: How to synchronise the publish version to the assembly version in a .NET ClickOnce application?
Windows Develop - Assembly Version to track the Publish Version
(The site no longer exists after 6 years from answer)
精彩评论