Solved

version in VS/ .NET Framework

Posted on 2013-06-17
15
645 Views
Last Modified: 2013-06-18
Is there build in version stuff in VS and/or .NET Framework?  I think there are Framework methods that can be called to get version info.  Where does it get this info?  web.config?
0
Comment
Question by:HLRosenberger
  • 5
  • 4
  • 4
  • +1
15 Comments
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 200 total points
ID: 39253199
you can use
Environment.Version()

Open in new window

, to get .net version.
if u want to know service pack as well then use this:
Dim installed_versions As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\NET Framework Setup\NDP")
Dim version_names As String() = installed_versions.GetSubKeyNames()
Dim Framework As Double = Convert.ToDouble(version_names(version_names.Length - 1).Remove(0, 1), CultureInfo.InvariantCulture)
Dim SP As Integer = Convert.ToInt32(installed_versions.OpenSubKey(version_names(version_names.Length - 1)).GetValue("SP", 0))

Open in new window

0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 200 total points
ID: 39253207
The version info of what exactly? .NET? Windows? Your own assembly?
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39253234
Ah, sorry.  my assembly. And a my WEB site project.
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 200 total points
ID: 39253251
the assembly version:
Dim assembly As Assembly = Assembly.GetExecutingAssembly()
Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location)
Dim version As String = fvi.FileVersion

Open in new window

0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39253266
But how/where is the version set?
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 200 total points
ID: 39253273
u set the version in the AssemblyInfo file of your project:
http://support.microsoft.com/kb/556041
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 200 total points
ID: 39253319
You can easily get to this information (as opposed to opening up the file directly) by going to your project's properties, and then selecting the "Application" tab, and then clicking the "Assembly Information..." button.

Screenshot
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
LVL 1

Author Comment

by:HLRosenberger
ID: 39253341
ok.   I have this in assembly.vb.

<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>


However, when I run this code, I get a version of 0.0.0.0.    See image.  My project is a WEB site.  Does this matter?  


       Dim assembly As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly()
        Dim fvi As FileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location)
        Dim version As String = fvi.FileVersion
version.png
0
 
LVL 1

Author Comment

by:HLRosenberger
ID: 39253350
kaufmed - This is a WEB site project.  I do not see an applications tab under properties.   For a DLL project or console app, I do see the application tab.
0
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 200 total points
ID: 39253368
you can us the core dll in your web site project and use its assembly version as a reference to your web site version.
so u update the AseemblyInfo if this dll, and to get the version from code you use thisL
typeof(TheDllClass).Assembly.GetName().Version.ToString()

Open in new window

0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 200 total points
ID: 39253369
Try reviewing and applying the information found here:

http://odetocode.com/blogs/scott/archive/2006/01/24/assemblyversion-and-web-projects.aspx

I don't work with web sites; most of my work is with web applications, to which my previous comment applies.
0
 
LVL 78

Assisted Solution

by:David Johnson, CD, MVP
David Johnson, CD, MVP earned 100 total points
ID: 39254688
Websites don't normally  have .dll's ergo no versioning..
0
 
LVL 75

Assisted Solution

by:käµfm³d 👽
käµfm³d   👽 earned 200 total points
ID: 39254816
@ve3ofa

I take it you were speaking in the general sense of the term "website." A .NET website project can be pre-compiled, which would yield a DLL. Withstanding, what is version other than applying an incremental number to the new incarnation of a piece of code. There is nothing stopping you from versioning an HTML file, should you so desire.
0
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 100 total points
ID: 39255062
Yes I was referring to in general. Precompiling a website for deployment is another issue entirely.
0
 
LVL 1

Author Closing Comment

by:HLRosenberger
ID: 39256347
Thanks to all!
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Anyway to make "All" the default in the dropdown? 6 34
Error on link 14 38
Get Top Visible Row of Datagridview 6 27
ASP.net show message while code is running 3 8
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now