29
Views
2
Comments
Solved
What exactly is the best way to download and reference NuGet packages in extensions?

When I create a custom extension that requires downloading a NuGet package I put it into a packages.config file and make sure all the references' Copy Local properties are set to true. 

Then I publish and test. And when I need to change something and open the IDE I see this:

My references are still there, but the packages.config file was removed during the publish.

Making my changes and building the solution doesn't result in errors. If I need to download a new package it recreates the packages.config file, but only with the newly downloaded packages. After I publish this, and then reopen the code in the IDE, I get the same result. The packages.config file is missing, but the newly added reference is being properly referenced in the code with no errors showing.

What exactly is going on here? Is this expected behavior? What's the best practice? Just ignore it? Or add the references using packages.config, set them to copy locally, and then delete the packages.config file from the project folder?

2021-10-09 07-57-44
Stefan Weber
 
MVP
Solution

Hi,

after you added your first package and the package.config file gets created in your source code switch back to Integration Studio (leave Visual Studio still open). In Integration Studio switch to the Resource tab and find the package.config in the source tree. Right click package.config and select Include in Extension.

This will add package.config to the extension files.

Best

Stefan

2022-11-14 17-25-57
Daniel Johnson

That worked! Thanks!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.