Reputation: 10713
I'm working in C#, .Net 2.0.
I want to search for a file in My documents -> Visual studio 'version'. The problem is that the user can have multiple VS installed. I, for example, have 2005, 2008 and 2010 and have three folders of VS in the 'My documents' folder.
In order to what I want, I need to know in which version of Visual studio the user is currently working.
I was thinking to open Windows task manager (by code) and in the 'Applications' part to look for the name of the project but I think that doesn't give me the version. Also, that means I'm gonna need the name of the solution of the user.
Other way is, again to open Windows task manager (by code) and in the 'Processes' part, in the 'Description' tab to look for the version. But, what if the user has multiple instances of VS opened?
Is there some combination of the both methods described above? Or some other idea on how to do this?
Upvotes: 3
Views: 2974
Reputation: 6394
Use FileVersion mixed with Getting the path of a process (look for devenv.exe)
This should be able to give you the version of Visual Studio based on your usecase, if VS is running.
Upvotes: 3