Nice3point / RevitApi

Libraries for Revit plugin development
MIT License
47 stars 8 forks source link

[Need Help] Nuget Doesn't copy to bin directory #3

Open WallanceLee opened 1 year ago

WallanceLee commented 1 year ago

Hello, Thanks for providing this nuget package. But as I start my project with RevitTemplates, I didn't find RevitAPI.dll under bin directory. BTW, I wrote a plugin for Revit 2019. Could you help for this problem? I cannot determine the origin of this problem. When I open Visual Studio Solution build with diagnostics log level, I just find Visual Studio copying "_CopyFilesMarkedCopyLocal". So how do I mark nuget packages with copy local? But Surprisingly, I find Nice3point.Revit.Extension copied to bin directory.

image

BTW, forgive my poor grammar. Thanks for your time again.

Nice3point commented 1 year ago

The RevitApi libraries are not copied to the bin folder, they are included in the project as a ref. If you need a dll, get it from https://github.com/Nice3point/RevitApi/tree/develop/RevitAPI/Content or C:\Program Files\Autodesk\Revit 2023

What do you need them for?

WallanceLee commented 1 year ago

OK, but I am very confused when I use RevitProductUtility.GetAllInstalledRevitProducts() to encapsulate an API in ProjectA, and I reference ProjectA in ProjectB and call this API but it would cause System.IO.FileNotFoundException: 'Could not load file or assembly 'RevitAddInUtility, Version=20.0.0.0, Culture=neutral, PublicKeyToken=null'. ' Could you help me? BTW, this runtime error led me to the last question. So I suppose RevitAPI.dll and all Revit DLL should be runtime dependencies.

Nice3point commented 1 year ago

изображение

All of these libraries are loaded into the application domain. Therefore, these libraries do not need to be supplied with the plugin, and do not need to be copied into the bin folder. System.IO.FileNotFoundException is most likely caused by this project not being loaded into the Revit domain, can you drop the archive with the solution or show a screenshot of the assembly dependency diagram from dotPeek

изображение

af-lozano commented 3 months ago

Hi @Nice3point , just out of curiosity, how is the implementation of assemblies not being included as references done? Do you specify it on nuget or is it in the csproj of the module? Thanks in advance. I was migrating a plugin to an SDK style app and implemented your package but was wondering how the equivalent of disabling copy local was done.

Nice3point commented 3 months ago

@af-lozano this is implemented at the Nuget package level. https://github.com/Nice3point/RevitApi/blob/main/RevitAPI/RevitAPI.csproj#L24

PackagePath="ref/" includes the package by reference, without copying it to the bin directory