version in VS/ .NET Framework

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?
LVL 1
HLRosenbergerAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
David Johnson, CD, MVPConnect With a Mentor OwnerCommented:
Yes I was referring to in general. Precompiling a website for deployment is another issue entirely.
0
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
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
 
käµfm³d 👽Connect With a Mentor Commented:
The version info of what exactly? .NET? Windows? Your own assembly?
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
HLRosenbergerAuthor Commented:
Ah, sorry.  my assembly. And a my WEB site project.
0
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
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
 
HLRosenbergerAuthor Commented:
But how/where is the version set?
0
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
u set the version in the AssemblyInfo file of your project:
http://support.microsoft.com/kb/556041
0
 
käµfm³d 👽Connect With a Mentor Commented:
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
 
HLRosenbergerAuthor Commented:
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
 
HLRosenbergerAuthor Commented:
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
 
Meir RivkinConnect With a Mentor Full stack Software EngineerCommented:
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
 
käµfm³d 👽Connect With a Mentor Commented:
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
 
David Johnson, CD, MVPConnect With a Mentor OwnerCommented:
Websites don't normally  have .dll's ergo no versioning..
0
 
käµfm³d 👽Connect With a Mentor Commented:
@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
 
HLRosenbergerAuthor Commented:
Thanks to all!
0
All Courses

From novice to tech pro — start learning today.