.NET Framework version - determine on thecommand line

J

Joubert

Hi,

Does anybody know how to do this? (excluding looking at the folder structure under %windir%)

Cheers
Joubert
 
J

Jon Skeet

Joubert said:
Does anybody know how to do this? (excluding looking at the
folder structure under %windir%)

Compile and run this console app:

using System;

public class Test
{
static void Main()
{
Console.WriteLine (Environment.Version);
}
}
 
J

Joubert

Perhaps I should have been more explicit.

I would like to use something which is guaranteed to be on the user's
computer (e.g. "c:\ver <return>").

If there is no known command line exe that is installed with the Framework,
can I see it elsewhere in the shell? E.g. My Computer\Properties or in
Explorer Help\About ??

Cheers
Joubert
 
J

Jon Skeet

BenoitM said:
perhaps it won't help, but if you do 'AL /?' it display the version of the
framework for which it's built ...

Similarly just running csc with no arguments will give:

Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Copyright (C) Microsoft Corporation 2001-2002. All rights reserved.

fatal error CS2008: No inputs specified

Of course, csc isn't on the path by default...
 
J

Joubert

plus it doesn't come with the .NET Framework distributable (correct me if
I'm wrong), so it is still not a satisfactory solution.. :-(
 
B

BenoitM

not verified, but i think that csc & al are installed with the redist,
because they are needed for asp.net dynamic compilation ...
anyway i looked at the dotnetfx.exe and i'm sure that ngen.exe is installed
on the target machine, so you can use 'ngen /?' ...

Joubert said:
plus it doesn't come with the .NET Framework distributable (correct me if
I'm wrong), so it is still not a satisfactory solution.. :-(
 
J

Joubert

Great. That helps. It is just a pity ngen is not in the path. But at least
it is a solution.

Cheers



BenoitM said:
not verified, but i think that csc & al are installed with the redist,
because they are needed for asp.net dynamic compilation ...
anyway i looked at the dotnetfx.exe and i'm sure that ngen.exe is installed
on the target machine, so you can use 'ngen /?' ...
 
J

Jon Skeet

Joubert said:
plus it doesn't come with the .NET Framework distributable (correct me if
I'm wrong), so it is still not a satisfactory solution.. :-(

They definitely are in the redistributable - the SDK doesn't install on
Windows 98, so the redistributable is all I've got on my W98 box :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top