开发者

C#: Can I change the Assembly Version to be like this: 1.6?

In Visual Studio it only seems to allow the Assembly Version to be in the format:

0.0.0.0

If I change it to:

开发者_JAVA技巧
1.6

And read it in code I get 1.6.0.0

Is there any way to change this behavior for a shorter version?


Version objects inherently have 4 components, but you can display a short version number in code by calling the overloaded ToString() method:

Version v = new Version(1,6,0,0);
Console.WriteLine(v.ToString(2)); // prints "1.6"


No. Assembly versions are always 4 numbers. When retrieving in code, you'll always get an instance of System.Version, which has the numbers Major, Minor, Build, Revision.

Of course you can always set Build and Revision to 0 and only display the Major and Minor versions if you want. If you could describe more of your context (where you're using the version number) that would help.


No, simply because this is the way .Net assemblies work when it comes down to resolving the right version.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜