Push all packages to remote NuGet feed

stibay

I am trying to migrate my app to the new .Net Core 1.0. My build server does not have access to the internet so I have setup a local NuGet server running on the build server.

Is there a way I could have a script that reads my solution and pushes all new and updated packages to the remote NuGet Server?

I have looked around and found that you should be able to put these lines in the project.json file and it will push all the packages to the server.

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ],
    "postcompile": [
      "dotnet pack --no-build",
      "\"%project:Directory%\\..\\..\\nuget.exe\" push \"%project:Directory%\\bin\\%compile:Configuration%\\%project:Name%.%project:Version%.nupkg\" -source http://xx.xxx.xx.xx/nuget -ApiKey "
    ]
  },

I am however getting an error after the dotnet pack --no-build finishes.

The system cannot find the file specified C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets

And if I double click on the error it opens the file and goes to

<Dnx
  RuntimeExe="$(SDKToolingExe)"
  Condition="'$(_DesignTimeHostBuild)' != 'true'"
  ProjectFolder="$(MSBuildProjectDirectory)"
  Arguments="$(_BuildArguments)"
  />

Any suggestions on a different solution for this?

Erikest

I think the common.targets part is a red herring. It's most likely that the nuget.exe or the push path aren't quite right.

What I would do is put the nuget push command in a .cmd file, pass the file paths in as arguments and then look at the output window to see the actual arguments that nuget is working with. Verify that those paths, both to the nuget exe and to the nupkg are accurate. You might be missing the framework folder in the path. For example, for me, my path would look more like

%project:Directory%\\bin\\%compile:Configuration%\\%compile:TargetFramework%\\%project:Name%.%project:Version%.nupkg

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Download all packages from private nuget feed

No packages found for TeamCity NuGet feed

How to get the list of all the packages with their versions from Artifacts/Nuget Feed in Azure Devops using C#?

Failure to restore nuget packages from organisation feed

push NuGet packages to TeamCity NuGet server

Remove foreign nuget packages from private nuget feed

Non-proprietary Nuget Packages Showing in Nuget Server/Artifacts Feed

Get all nuget packages in solution

Nuget Issue - 404 for all packages

One release pipeline for all packages of a feed?

TFS on premise can't restore nuget packages from private feed

Why are there Microsoft packages in my private Nuget Feed in DevOps Artifacts?

Can I upload existing NuGet packages to an Azure DevOps artifacts feed?

overwrite nuget packages in feed on visual studio team services

TFS ONPREMISE - Package Feed - BuildAgent do not restore Nuget Packages : 403

TeamCity Nuget Feed does not pick up latest Packages from a build

NuGet packages do not show after pushing to private NuGet Feed (NuGet.Server, IIS)

NuGet Push task, enter a variable name in Target Feed

Push all remote tracking branches to new remote?

Cannot add or update NuGet packages, receiving NuGet V2 feed error

unlist all versions of a nuget package from VSTS package feed

Use NuGetCommand@2 to push packages to nuget.org

Nuget restore returns 401 unauthorized during Jenkins build for packages in Azure DevOps artifacts feed

Is it possible to host both regular and symbols packages in a NuGet local feed on a network share?

Delete NuGet packages from Visual Studio Online Package Feed instead of Unlist

Some packages can't be downloaded from Azure DevOps Artifacts feed with NuGet upstream source

git push all remote branches to a new origin

Is it possible to update some but not all NuGet packages in Xamarin 3?

Is it necessary to update all nuget packages when upgrading a project?