Differences between nuget-packing a csproj vs. nuspec

后端 未结 4 1495
礼貌的吻别
礼貌的吻别 2020-12-13 17:27

Recently, I started to pack nuget packages out of my several projects. First I started with the Package Explorer application. It is a nice tool, but it\'s less useful if you

4条回答
  •  清歌不尽
    2020-12-13 17:45

    With .NET Core as of February 2018 you'll need to supply a .nuspec file for any more than the basic spec file properties.

    But the dotnet pack command will not use the .nuspec file unless you add relative path to nuspec to the .csproj file.

    See https://github.com/dotnet/cli/issues/2170

    Most packages can now be made without a .nuspec file. The thing to watch is the dependencies. You may need to add a PrivateAssets element to some that are tools, like msbump and um, SpecFlow maybe.

    
      all
    
    

    This stops this package dependency "flowing" to the dependencies of your package.

    Also worth reading about specifying versions in the most flexible way.

    https://docs.microsoft.com/en-us/nuget/consume-packages/dependency-resolution#floating-versions

    And range syntax.

    https://docs.microsoft.com/en-us/nuget/reference/package-versioning#references-in-project-files-packagereference

提交回复
热议问题