How to get the REVIT execution path programtically?

How to get the REVIT execution path programtically?

Anonymous
Not applicable
2,754 Views
3 Replies
Message 1 of 4

How to get the REVIT execution path programtically?

Anonymous
Not applicable

I am using C# to develop addin for Revit 2016.

 

My Revit is installed under a directory. e.g.   D:\REVIT\Revit 2016\Revit.exe

 

 

How can I get the path using C#?

0 Likes
Accepted solutions (1)
2,755 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk
Accepted solution

Normally, you have no need whatsoever to determine the path of Revit.exe to install and run your add-in.

 

Please work through the getting started material first of all, before asking any other questions:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#2

 

That will explain all you need to know about the fundamentals, add-in architecture, installation and running.

 

If you really need to know the location of Revit.exe for some other reason, you can easily use the basic .NET operating system functionality, e.g., to search your file system for Revit.exe itself. 

 

Also, please be aware of the Revit API installation utility named RevitAddInUtility that also provides this kind of functionality:

 

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 3 of 4

Dale.Bartlett
Collaborator
Collaborator

The registry holds this information:

Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Autodesk\Revit\2020\REVIT-05:0809

Name                           Data
InstallationLocation        C:\Program Files\Autodesk\Revit 2020\
InstallationType             standalone
Language                      English
ProductName                 Autodesk Revit 2020
SerialNumber                 xxx-xxxxxxxx
Version                         2020 (20.0.0.377)

 

There are lots of examples on line (including from Jeremy) to read the registry.




______________
Yes, I'm Satoshi.
0 Likes
Message 4 of 4

peter_hirn
Enthusiast
Enthusiast
Process.GetCurrentProcess().MainModule.FileName
0 Likes