Reputation: 1220
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?
Upvotes: 0
Views: 1074
Reputation: 5097
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
Upvotes: 1