Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c#

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:

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?

like image 920
Shane Grant Avatar asked Nov 18 '10 07:11

Shane Grant


People also ask

What C is used for?

C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...

Is C language easy?

Compared to other languages—like Java, PHP, or C#—C is a relatively simple language to learn for anyone just starting to learn computer programming because of its limited number of keywords.

What is the full name of C?

In the real sense it has no meaning or full form. It was developed by Dennis Ritchie and Ken Thompson at AT&T bell Lab. First, they used to call it as B language then later they made some improvement into it and renamed it as C and its superscript as C++ which was invented by Dr.

Why is C named so?

Because a and b and c , so it's name is C. C came out of Ken Thompson's Unix project at AT&T. He originally wrote Unix in assembly language. He wrote a language in assembly called B that ran on Unix, and was a subset of an existing language called BCPL.


2 Answers

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"
like image 83
Bradley Smith Avatar answered Nov 13 '22 08:11

Bradley Smith


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.

like image 41
Jon Skeet Avatar answered Nov 13 '22 07:11

Jon Skeet