I hope someone can help me, I was trying to do following tutorial about automatic creation of nuget packages:

http://msdn.microsoft.com/en-us/vs2010trainingcourse_aspnetmvcnuget_topic2

I made following batch file:

@echo off
..\BUILD\NuGet\NuGet.exe pack .\defs.nuspec -OutputDirectory ..\BUILD\myPackages

I can run this file from explorer or shell without problems. When I try to call this batch from the Post_Build event handler of VS2010: (Post-Build event command line)

call "$(ProjectDir)CreateNuGetPackage.bat"

It always return:

Error   47  The command "call "C:\development\mysolution\myproject\CreateNuGetPackage.bat"" exited with code 1. 

Even if this path is right.

I even try to make a .cmd file with the same content which also generated the NuGet package without problems but not within the Post-Build dialog. I've also tried to put the content of the bath in the Post-Build event dialog (as defined in the article):

C:\development\mysolution\myproject\..\BUILD\NuGet\NuGet.exe pack C:\development\mysolution\myproject\defs.nuspec -OutputDirectory C:\development\mysolution\myproject\..\BUILD\myPackages

And I'm still getting the same error... I really have no clue what can be going wrong, I hope someone can help me or give me an alternative way of generating such packages.

Thanks!!

有帮助吗?

解决方案

I finally ended up solving the problem: I had to copy an instance of Nuget to the folder where my solution lies. Even if Nuget was in the path. I still don't know why VS was not able to find nuget if started from a post-build event (I'm not using nuget anymore, it doesn't fit my needs as I was expecting something similar to maven).

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top