PackageContents.xml - Is there a way to group shared files instead of copying them for each Revit version?

PackageContents.xml - Is there a way to group shared files instead of copying them for each Revit version?

adam_konca
Enthusiast Enthusiast
765 Views
8 Replies
Message 1 of 9

PackageContents.xml - Is there a way to group shared files instead of copying them for each Revit version?

adam_konca
Enthusiast
Enthusiast

This is our PackageContents.xml file:

<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage>
  <Components Description="Revit 2019">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2019" SeriesMax="R2019" />
    <ComponentEntry ModuleName="./Contents/2019/Name.addin" />
  </Components>
  <Components Description="Revit 2020">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2020" SeriesMax="R2020" />
    <ComponentEntry ModuleName="./Contents/2020/Name.addin" />
  </Components>
  <Components Description="Revit 2021">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2021" SeriesMax="R2021" />
    <ComponentEntry ModuleName="./Contents/2021/Name.addin" />
  </Components>
  <Components Description="Revit 2022">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2022" SeriesMax="R2022" />
    <ComponentEntry ModuleName="./Contents/2022/Name.addin" />
  </Components>
  <Components Description="Revit 2023">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2023" SeriesMax="R2023" />
    <ComponentEntry ModuleName="./Contents/2023/Name.addin" />
  </Components>
</ApplicationPackage>


We have some shared dll's that are used in each of those versions. Our goal is to create a Shared directory that would be used by all components, so that we can include only 1 copy instead of 5 copies of each shared dll. Is this doable with PackageContents.xml?

766 Views
8 Replies
Replies (8)
Message 2 of 9

ricaun
Advisor
Advisor

Your PackageContents look great!

 

I never tried to share dll between versions only image/text/rfa.

 

I guess is possible if you handle the assembly load in your main Name.dll. (Does not worth it)

 

Is easy to send 5 versions of the same dll, in my case I do exactly like that.

 

Each version has your own dll references and works great!

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 3 of 9

adam_konca
Enthusiast
Enthusiast
Yeah, I don't really want to manually load assemblies either.
That's why I was wondering if there is a way to just point at them in PackageContents and further reduce size of the whole addin package 🙂
Message 4 of 9

ricaun
Advisor
Advisor

I believe the PackageContents job is to select the right application(Revit) and version, and pointing to the addin to be loaded, in this case Name.addin.

 

Here is some info about PackageContent: https://www.autodesk.com/autodesk-university/class/AppBundle-Cross-Distribution-Autodesk-Products-Ap...

 

 

 

 

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

Message 5 of 9

adam_konca
Enthusiast
Enthusiast

I have managed to accomplish what I wanted by simply placing all the files in a single directory.

<?xml version="1.0" encoding="utf-8" ?>
<ApplicationPackage>
  <Components Description="Revit 2022">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2022" SeriesMax="R2022" />
    <ComponentEntry ModuleName="./Contents/Name2022.addin" />
  </Components>
  <Components Description="Revit 2023">
    <RuntimeRequirements OS="Win64" Platform="Revit" SeriesMin="R2023" SeriesMax="R2023" />
    <ComponentEntry ModuleName="./Contents/Name2023.addin" />
  </Components>
</ApplicationPackage>

 Of course that requires me to rename some of the files: .addin files (for example: Name2022.addin, Name2023.addin) and my addin DLL files (for example: Name2022.dll, Name2023.dll). Then modify .addin files to point to the correct DLL and viola. Everything works. All libraries used by Name2022.dll and Name2023.dll are also in the same folder and do not have to be duplicated.

I still haven't decided if I am going to use this method as the original one feels cleaner. Please let me know if there are any downsides of the method I just described. Thanks!

Message 6 of 9

ricaun
Advisor
Advisor
Cool that's should work 😊

The only disadvantage I can think about is gonna look messy, and you gonna gain some free space or a small bundle plugin.

It's all depend how big is your bundle with share files and without shared files.

I believe does not worth it, but I already have a build automation to create the bundle.zip for each version in the csproj.

Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 7 of 9

adam_konca
Enthusiast
Enthusiast
Exactly. I did some checks and the whole release package would go down from around 90 MB to around 60 MB in size. On the one hand it's 1/3 less, so not bad. On the other hand, it's hard to decide whether 30 MB less justifies switching to a more messy solution 🙂
0 Likes
Message 8 of 9

ricaun
Advisor
Advisor
90Mb is kinda a big but if you compare with Revit installation with 5Gb and beyond, and a Revit file has easily 100Mb.

What kinda of dll did you have in your bundle, in a zip format my bundle usually goes to 7Mb and aí have separated versions 2018 to 2023.

Are you sipping the RevitApi.dll with you bundle?
Luiz Henrique Cassettari

ricaun.com - Revit API Developer

AppLoader EasyConduit WireInConduit ConduitMaterial CircuitName ElectricalUtils

0 Likes
Message 9 of 9

adam_konca
Enthusiast
Enthusiast
No, that's the size after excluding Revit API files. The heaviest libs we use are:
- ClosedXML (which references OpenXML)
- PdfSharp
- IsoNames
Those 3 libraries together take 12,2 MB. Multiply that by 5 (revit versions) and you you get 61 MB.
Addin code itself is around 1 MB + we have some other lightweight libs and source Revit files to copy some stuff from.
Of course this is unzipped directory after installation (around 90 MB). Zipped is around 28 MB.