Hi.
some API/Object different REVIT 2012 / 2014. (like get_Element / GetElement)
i can not compile my source when i change REVIT 2014 RevitAPI.DLL & RevitApiUI.DLL.
so i think, make different DLL & different '.addin' file for REVIT 2014 / REVIT others.
but i can not know, what REVIT version call my DLL.
when OnStartUp function enroll button & event in my DLL. so i need i will use 2014.DLL or 2012.DLL.
but
RevitProduct revitProduct1 = RevitProductUtility.GetAllInstalledRevitProducts()[0]; RevitAddInManifest revitAddInManifest = Autodesk.RevitAddIns.AddInManifestUtility.GetRevitAddInManifest( revitProduct1.AllUsersAddInFolder + "\\RevitAddInUtilitySample.addin");
this code only for first installed REVIT info.
sure, i think compare each Products[] between current excute REVIT version.
but i can not use Revit.Application.Application.VersionName because Revit is NULL.
how can i support each REVIT 2012/2014 on same computer?
Solved! Go to Solution.
Dear combachi,
Yes, you have to create a different version of your .NET add-in assembly for each version of Revit.
They are placed in separate directories for loading, e.g. for Revit 2014 one of these:
/ProgramData/Autodesk/Revit/Addins/2014
/Users/All Users/Autodesk/Revit/Addins/2014
/Users/<username>/AppData/Roaming/Autodesk/Revit/Addins/2014
When your add-in is loaded, it can query the application object for its version information, e.g. using the the Application VersionBuild, VersionName and VersionNumber properties.
Best regards,
Jeremy
I solved like this.
first.
make differrent DLL name & .addin name for REVIT2012 / REVIT2014.
Next. change code like this
Old Code
Autodesk.RevitAddIns.RevitProduct oRP = Autodesk.RevitAddIns.RevitProductUtility.GetAllInstalledRevitProducts()[0]; Autodesk.RevitAddIns.RevitAddInManifest oManifest = Autodesk.RevitAddIns.AddInManifestUtility.GetRevitAddInManifest( oRP.AllUsersAddInFolder + @"\MyProgram.AddIn");
New Code
string sExeName = Path.GetFileNameWithoutExtension(System.Reflection.Assembly.GetExecutingAssembly().Location);
foreach (Autodesk.RevitAddIns.RevitProduct oRP in Autodesk.RevitAddIns.RevitProductUtility.GetAllInstalledRevitProducts()) { if (File.Exists(oRP.AllUsersAddInFolder + @"\" + sExeName + @".Addin") == true) { Autodesk.RevitAddIns.RevitAddInManifest oManifest = Autodesk.RevitAddIns.AddInManifestUtility.GetRevitAddInManifest( oRP.AllUsersAddInFolder + @"\" + sExeName + @".Addin"); break; } }