Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / June 2006

Tip: Looking for answers? Try searching our database.

Get Dotnet Framework version from command line

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
bcastaing@gmail.com - 28 Jun 2006 17:45 GMT
Hi everybody,

I write a VBS script witch uses csc.exe (command line dotnet compiler),
but my problem is to detect what version of Dotnet Framework is
installed on the server to use the good repertory 1.1 or 2.0 (v1.1.4322
or v2.0.50215 ...)
What command line or script can I use to get this information ?

Thanks to all for any advice

Bruno
Mattias Sjögren - 28 Jun 2006 19:47 GMT
>I write a VBS script witch uses csc.exe (command line dotnet compiler),
>but my problem is to detect what version of Dotnet Framework is
>installed on the server to use the good repertory 1.1 or 2.0 (v1.1.4322
>or v2.0.50215 ...)
>What command line or script can I use to get this information ?

You can have both installed. If you simply want to use v2 if available
and otherwise fall back on v1.1, can't you simply check if
%WINDIR%\Microosft.NET\Framework\v2.0.50727\csc.exe exists?

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

bcastaing@gmail.com - 29 Jun 2006 09:36 GMT
Yes I can, but how can I check if a newer version is installed in the
future ?

Bruno

> >I write a VBS script witch uses csc.exe (command line dotnet compiler),
> >but my problem is to detect what version of Dotnet Framework is
[quoted text clipped - 12 lines]
> http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
> Please reply only to the newsgroup.
Damien - 29 Jun 2006 13:51 GMT
> > >I write a VBS script witch uses csc.exe (command line dotnet compiler),
> > >but my problem is to detect what version of Dotnet Framework is
[quoted text clipped - 16 lines]
>
> Bruno

On the other hand, how would you know if the code you're trying to
compile uses deprecated/unsupported features, or features for which
breaking changes have been made, in a later version of the framework.

Your situation is: you *know* (or have good reason to suspect) that
your code compiles with C# 2.0. You *know* (or have good...) that your
code compiles with C# 1.1. Your code may work with C#3.0 beta. Does
your code compile with version 4, with version 5, etc?

I've taken a quick scan through the registry, but there doesn't seem to
be anything obvious. You could try enumerating keys under
HKLM\Software\Microsoft\NET Framework Setup\NDP and getting the latest
version, then looking under the directory you can find through the
InstallRoot value under the HKLM\Software\Microsoft\.NET Framework key.
(Or directly search the directories under that directory for
directories which match the patter vn.n.nnnn)

In either case, you'll be dealing with strings and you'll have to do
careful parsing (if you're really future-proofing) that, for instance,
v10.0 sorts higher then v2.

Good luck!

Damien
bcastaing@gmail.com - 29 Jun 2006 16:51 GMT
Hi,

The Microsoft.NET registry key seems to be different between version
1.1 or 2.0, so do you the better solution to get the actual version
installed ?
Is it listing %WINDIR%\Microosft.NET\Framework\*. and sort the result
and get the highest value ?
Or WMI fonction ?
Do you know a script to do any working solution ?

Thanks
Bruno

Damien a écrit :

> > > >I write a VBS script witch uses csc.exe (command line dotnet compiler),
> > > >but my problem is to detect what version of Dotnet Framework is
[quoted text clipped - 41 lines]
>
> Damien

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.