1
votes

I have a .Net Core library project which i want to share with all our other projects. These other projects are developed in Classic 4.6.2 and ASP.NET Core. I want to share it using Nuget package. Since package needs to be private i will be hosting it on our server. The .net core library project i am trying to publish has the following project.json

{
  "version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.6.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

I followed these guidelines [here][1] to create a package

  1. Created the .nuspec package manifest file using nuget spec command
  2. Updated nuspec file as per the suggestion
  3. Tried creating package with command nuget pack MyProject.xproj got error

Please specify a nuspec or project file to use.

  1. Looks like nuget does not recognize xproj So executed command nuget pack MyProject.nuspec

    got warning

WARNING: 2 issue(s) found with package 'MyId'.

Issue: Assembly outside lib folder. Description: The assembly 'bin\Debug\netstandard1.6\MyProject.dll' is not inside the 'lib' folder and hence it won't be added as reference when the package is installed into a project. Solution: Move it into the 'lib' folder if it should be referenced.

Issue: Assembly outside lib folder. Description: The assembly 'bin\Release\netstandard1.6\MyProject.dll' is not inside the 'lib' folder and hence it won't be added as reference when the package is installed into a project. Solution: Move it into the 'lib' folder if it should be referenced.

I have already already looked SO post [here][2] and [here][3] but it couldn't solve my issue

1
have you tried using dotnet pack?Thomas
@Thomas yes i used and it created the package successfully. However i am hosting package on private server using approach here docs.nuget.org/ndocs/hosting-packages/nuget.server . When i add the nupkg file into packages folder and build the solution it didnt create the packages as mentionedLP13
Well... I guess your packaging is not your problem then.Thomas
@LP13 it looks like your referenced links ([1] ... [3]) are gonesuperjos

1 Answers

0
votes

If you have to use your own Nuget Server I would suggest that you actually use the nuget utility to push the package to your server. I usually write a small batch file that can be scheduled with build events or execute when I explicitly want to deploy new packages of the cross cutting concern portable class libraries.

The batch file could be something as simple as:

FOR %%I in (<PATH_TO_YOUR_DEBUG_FOLDER>\*.nupkg) DO nuget.exe push "%%I" -Source http://<NUGET_SERVER>/api/v2/package?replace=true

Note that by adding the replace query string at the end and changing your nuget config to allow for replacements you do'nt have to go through all the pain to reversion things.

Alternatively you could just make use of a private feed:

  1. Create a folder where you want local packages to live
  2. Add nuget config file to the root of your solution that specifies the private feed location
  3. Then use a similar push command
  4. Restart Visual Studio if the private feed is not visible.