Create nuget package with multiple DLLs

后端 未结 8 1733
忘了有多久
忘了有多久 2020-12-25 09:58

Let\'s say I have a project with this structure:

MyLibrary\\
  MyLibrary.sln
  MyLibrary.Core\\
    MyLibrary.Core.csproj
  MyLibrary.Extensions\\
    MyLibr         


        
8条回答
  •  眼角桃花
    2020-12-25 10:28

    I had an issue when adding extra dlls references to a Nuget packages, and testing the package on a sample project, the extra dlls was not being added apparently, no matter the way that I create the Nuget Package.

    Then I released that when you uninstall and install again a local Nuget Package with the same version number the changes no take effect, the extra dlls are not added.

    So each time you uninstall the package, close visual studio and clear the Nuget Cache,

    How to clear NuGet package cache using command line?

    Then open again Visual Studio and reinstall the local package to make the change takes effect.

    Or make the package version to increase each time to be for Visual Studio to recognize your changes.

    For example:

    • Package-1.0.0
    • Package-1.0.1
    • Package-1.0.2
    • .....

    To create a Nuget package from a sample project there are some ways, for example:

    1. Right click to your Visual Studio project and choose the "Pack" option

    Then install the nuget package explorer:

    https://www.microsoft.com/es-ec/p/nuget-package-explorer/9wzdncrdmdm3?activetab=pivot:overviewtab

    And add manually your extra references (dlls files) to your specific targets.

    1. Create a nuget package using a .nuspec file how specified in the documentation:

    https://docs.microsoft.com/en-us/nuget/guides/create-packages-for-xamarin

       
            
            
            
            
       
    

    In your files part add your .dll files.

    And dont forget, each time you uninstall and install again the nuget package from your local source.

    • Or you increase the version of the package each time:

    • Or close Visual Studio, clean the nuget cache and Rebuild your project.

    In order to take effect the changes.

提交回复
热议问题