How to set up conditional compilation and conditional references to different DLL versions so your API program can simultaneously support Revit 2013, 2014, and 2015.
How to set up conditional compilation and conditional references to different DLL versions so your API program can simultaneously support Revit 2013, 2014, and 2015.
Awesome info, thanks Harry
I just started updating my addins using this great method, thanks again for the info.
I wanted to note that I also found that you can add the configuration to the Build Events like so:
if $(ConfigurationName) == 2014 copy “$(ProjectDir)bin\2014\some.dll” “$(AppData)\Autodesk\REVIT\Addins\2014”
if $(ConfigurationName) == 2015 copy “$(ProjectDir)bin\2014\some.dll” “$(AppData)\Autodesk\REVIT\Addins\2015”
Hello Harry
thanks for posting this, however, I believe it is better to wrap the revit version dependant code in calls to dependant dll’s (C#projects). This means you don’t have to create multiple builds (and configurations) for multiple versions of Revit. Thus the same addin can be used in multiple revit versions.
[…] https://boostyourbim.wordpress.com/2014/04/18/upgrading-your-api-applications-to-a-new-revit-version… […]
Does the ADWindows.dll also need to be factored in as being version dependent?
Probably not, but you would if you are using functions in that DLL that have been obsoleted
what about different dot net frameworks ? will it not effect on that >?
I edit the CSPROJ file to add a PropertyGroup entry for each Revit version. It contains the .net version for that version of Revit. Please see this more recent post
that is awesome.
I spent whole day struggling with dot net core and it is still too early to have stable work with the dot net core.
thanks, I will check this
keep up the good work
I was able to build for 4 different versions of Revit using this tutorial. Thank you very much!
I do have a question for you , I have a post-build command as follows :
if exist “$(AppData)\Autodesk\REVIT\Addins\2022” copy “$(ProjectDir)*.addin” “$(AppData)\Autodesk\REVIT\Addins\2022”
if exist “$(AppData)\Autodesk\REVIT\Addins\2022” copy “$(ProjectDir)$(OutputPath)*.dll” “$(AppData)\Autodesk\REVIT\Addins\2022”
This copies the dll and the addin file that from the project directory to the Addin folder. I would like to add similar commands to the different configurations I’ve setup and would like them to execute only when that configuration is built. Right now the Configuration drop down menu is not available in the “Build Events” tab as it is in the “Build” tab. Is there a way to turn this feature on? Or is there a better way to achieve what I am trying to do?
You should be able to use Visual Studio “macros” like $(Configuration) which act like variables instead of hard-coding the version numbers like “2022”
For example,
copy /Y $(TargetPath) “C:\ProgramData\Autodesk\Revit\Addins\$(Configuration)\$(TargetName)”
More info at
https://learn.microsoft.com/en-us/cpp/build/reference/common-macros-for-build-commands-and-properties?view=msvc-170