Your question is a bit intriguing, because:
- At coding time, you know which VS.NET version you are using.
- At run-time, the executable can be running with .NET Framework 1.0 or 1.1,
depending on its configuration and the .NET Version on the target machine,
but it seems that you are not interested in the .NET Framework version
(returned by System.Environment.Version() )
The only relationship of the running executable with VS.NET is that maybe it
has attached the VS.NET debugger: your code can guess if it is beeing
debugged through System.Diagnostics.Debugger.IsAttached(), but I think that
you can not know which the debugger is.
So, although the goal of your question is beyond me, the only way that I can
think is guessing the running VS.NET through indirect ways, assuming that
you don´t have VS.NET 2002 and 2003 running side by side. For example:
- You can get the processes with the name "devenv.exe" and from there try to
get the path to the file and its version.
- You can get if there are COM objects running with the ProgIDs
"VisualStudio.DTE.7" (VS.NET 2002) or "VisualStudio.DTE.7.1" (VS.NET 2003).
In VB6 you would use the GetObject("MyProgID") function.
--
Carlos J. Quintero (Visual Developer - .NET MVP)
FAQs, Knowledge Base, Files, Docs, Articles, Utilities, etc. for .NET
addins:
http://groups.yahoo.com/group/vsnetaddin/ (free join)
"Whitney Kew" <Wh********@discussions.microsoft.com> escribió en el mensaje
news:FD**********************************@microsof t.com...
Hi,
Is there a programmatic way to get the "general" or "overall" version of a
currently running instance of the Visual Studio .NET compiler? What I
mean by "general" or "overall" version is, I want to programmatically get the
version string that I see in the registry underneath the
HKLM\SOFTWARE\Microsoft\VisualStudio key, such as "7.0" or "7.1" (for .NET
2002 or .NET 2003, respectively). My registry contains both 7.0 and 7.1
keys, so I want to know which one I'm currently running. Note that I am
not interested in getting the CLR version (that is, the version that is
returned by the GetCORVersion() call).
Thanks!
--
Whitney Kew
Software Engineer
Rain Bird Corporation
http://rainbird.com