This project has moved. For the latest updates, please go here.

Always returns error even generating the file

Apr 28, 2014 at 8:24 PM
Edited Apr 28, 2014 at 8:28 PM
I'm using Visual Studio 2012 and the whole project (also empty) generates error but generates the file correctly.

The command "REM Create a NuGet package for this project and place the .nupkg file in the project's output directory.
ECHO Building NuGet package in Post-Build event...
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:...\PostBuildScripts\BuildNewPackage-RanAutomatically.ps1' -ProjectFilePath 'C:...\Framework.Geral.csproj' -OutputDirectory 'C:...\bin\Release\' -Configuration 'Release' -Platform 'AnyCPU'"" exited with code 1. Name

Performing any required New-NuGetPackage script cleanup...
1> An error occurred while running New-NuGetPackage script:
1> Could not determine where NuGet Package was created to. Perhaps an error occurred while packing it. Look for errors from NuGet above (in the console window).
1>
1> Could not determine where NuGet Package was created to. Perhaps an error occurr
1> ed while packing it. Look for errors from NuGet above (in the console window).
Coordinator
Apr 28, 2014 at 8:27 PM
In Visual Studio, take a look at the Build tab of the Output window. In here you should find the actual error message, which is typically an error thrown from the NuGet.exe. If you are not sure about the error message, or can't find it, just copy-paste that entire window's contents here and I'll pick it out for you.
Jun 13, 2014 at 7:53 AM
I encounter exactly the same problem!!
Coordinator
Jun 13, 2014 at 1:13 PM
I can't help if I don't know what the actual error message is. Please copy-paste it in here from the Output window's Build tab as I mentioned above.
Jun 13, 2014 at 7:04 PM
I am getting the same errors. The following is the output. Looks like $packOutput is empty by line 1167.



1>PostBuildEvent:
1> REM Create a NuGet package for this project and place the .nupkg file in the project's output directory.
1> REM If you see this in Visual Studio's Error List window, check the Output window's Build tab for the actual error.
1> ECHO Building NuGet package in Post-Build event...
1> PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\PostBuildScripts\BuildNewPackage-RanAutomatically.ps1' -ProjectFilePath 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\VMS.Data.csproj' -OutputDirectory 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release\' -Configuration 'Release' -Platform 'AnyCPU'"
1> Building NuGet package in Post-Build event...
1> Pre-processing the project file to make sure the assembly exists where NuGet.exe will expect it to be, started at 14:58:48.1410330.
1> The Output Directory is the same as defined in the project file, so no pre-processing actions were required.
1> Pre-processing the project file finished running at 14:58:48.1680357. Completed in 0.0270027 seconds.
1> VERBOSE: New-NuGetPackage script started running at 14:58:48.2100399.
1> VERBOSE: About to run Pack command '& "C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\PostBuildScripts\NuGet.exe" pack
1> "C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\VMS.Data.csproj" -OutputDirectory "C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release"
1> -Properties Configuration="Release"`;Platform="AnyCPU" -NonInteractive '.
1> VERBOSE:
1> VERBOSE: Performing any required New-NuGetPackage script cleanup...
1> An error occurred while running New-NuGetPackage script:
1> Could not determine where NuGet Package was created to. This typically means that an error occurred while NuGet.exe was packing it. Look for errors from NuGet.exe above (in the console window), or in the following NuGet.exe output. You can also try running this command with the -Verbose switch for more information:
1>
1>
1> Could not determine where NuGet Package was created to. This typically means that an error occurred while NuGet.exe was packing it. Look for errors fr
1> om NuGet.exe above (in the console window), or in the following NuGet.exe output. You can also try running this command with the -Verbose switch for m
1> ore information:
1> At C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\PostBuildScripts\New-NuGetPackage.ps1:1178 char:12
1> + throw <<<< "Could not determine where NuGet Package was created to. This typically means that an error occurred while NuGet.exe was pac
1> king it. Look for errors from NuGet.exe above (in the console window), or in the following NuGet.exe output. You can also try running this command wit
1> h the -Verbose switch for more information:{0}{1}" -f [Environment]::NewLine, $packOutput
1> + CategoryInfo : OperationStopped: (Could not deter... information:
1> :String) [], RuntimeException
1> + FullyQualifiedErrorId : Could not determine where NuGet Package was created to. This typically means that an error occurred while NuGet.exe was
1> packing it. Look for errors from NuGet.exe above (in the console window), or in the following NuGet.exe output. You can also try running this co
1> mmand with the -Verbose switch for more information:
1>
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4507,5): error MSB3073: The command "REM Create a NuGet package for this project and place the .nupkg file in the project's output directory.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4507,5): error MSB3073: REM If you see this in Visual Studio's Error List window, check the Output window's Build tab for the actual error.
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4507,5): error MSB3073: ECHO Building NuGet package in Post-Build event...
1>C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(4507,5): error MSB3073: PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\PostBuildScripts\BuildNewPackage-RanAutomatically.ps1' -ProjectFilePath 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\VMS.Data.csproj' -OutputDirectory 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release\' -Configuration 'Release' -Platform 'AnyCPU'"" exited with code 1.
1>
1>Build FAILED.
Jun 13, 2014 at 7:15 PM
Removing the packCommand Invoke null redirect actually shows there is NuGet output:




1>PostBuildEvent:
1> REM Create a NuGet package for this project and place the .nupkg file in the project's output directory.
1> REM If you see this in Visual Studio's Error List window, check the Output window's Build tab for the actual error.
1> ECHO Building NuGet package in Post-Build event...
1> PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\PostBuildScripts\BuildNewPackage-RanAutomatically.ps1' -ProjectFilePath 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\VMS.Data.csproj' -OutputDirectory 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release\' -Configuration 'Release' -Platform 'AnyCPU'"
1> Building NuGet package in Post-Build event...
1> Pre-processing the project file to make sure the assembly exists where NuGet.exe will expect it to be, started at 15:12:27.0709178.
1> The Output Directory is the same as defined in the project file, so no pre-processing actions were required.
1> Pre-processing the project file finished running at 15:12:27.0979205. Completed in 0.0270027 seconds.
1> VERBOSE: New-NuGetPackage script started running at 15:12:27.1359243.
1> VERBOSE: About to run Pack command '& "C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\PostBuildScripts\NuGet.exe" pack
1> "C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\VMS.Data.csproj" -OutputDirectory "C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release"
1> -Properties Configuration="Release"`;Platform="AnyCPU" -NonInteractive '.
1> Attempting to build package from 'VMS.Data.csproj'.
1> Packing files from 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release'.
1> Found packages.config. Using packages listed as dependencies
1>EXEC : warning : Description was not specified. Using 'Description'.
1> Successfully created package 'C:\source-svn\VMS\11.4.0.0\VMS\VMS.Data\bin\Release\VMS.Data.11.4.5.6543.nupkg'.
1> VERBOSE:
1> VERBOSE: Performing any required New-NuGetPackage script cleanup...
1> An error occurred while running New-NuGetPackage script:
1> Could not determine where NuGet Package was created to. This typically means that an error occurred while NuGet.exe was packing it. Look for errors from NuGet.exe above (in the console window), or in the following NuGet.exe output. You can also try running this command with the -Verbose switch for more information:
1>
Coordinator
Jun 13, 2014 at 7:56 PM
Hmmmm, I'm unable to reproduce the problem on my end. Which version of the NuGet package are you using? The latest v1.8.0? Also, what version of PowerShell do you have installed? You can run $PSVersionTable.PSVersion from a powershell command prompt to find out.
Jun 13, 2014 at 8:05 PM
I am using 1.8.

Powershell version:
Major Minor Build Revision

2 0 -1 -1
Coordinator
Jun 13, 2014 at 8:25 PM
Bah, I bet that I unintentionally introduced a change that requires PowerShell v3. I'll investigate this some more. Thanks.
Jun 14, 2014 at 8:00 AM
Hi, I am using your NuGet package v1.8 and my PowerShell version is 3, 0, -1, -1, but I still get the build error. The error message in the output window is exactly the same with cadditon's. The .nupkg file does get created in the output folder though.

Could you help us look into this issue? Thanks.
Coordinator
Jun 14, 2014 at 12:10 PM
Edited Jun 14, 2014 at 12:12 PM
If you create a brand new vanilla solution and only install this NuGet Package do you still get the error? Could one of you provide me with a solution that reproduces the problem please, since I am unable to reproduce it on my machine. I'm not sure if the problem is due to machine or project configuration yet at this point, and that would help me determine the problem.

P.S. I've unlisted the v1.8 package from the NuGet gallery, so the latest Stable version that will be downloaded is v1.7.3, as I don't believe it has this problem. In order to test this out you will need to set the NuGet package search to include Prerelease packages, and then v1.8.1-Prerelease1 should show up, and you can install that version in your vanilla solution to try and reproduce the problem.
Jun 16, 2014 at 3:59 AM
Yes, mine was a brand new vanilla solution.

I tried to look into the error yesterday and guess what, after I installed the Azure SDK for .NET v2.3 update from Visual Studio's extensions and updates manager, the error disappears! Now your project works perfectly fine, great job!!
Coordinator
Jun 16, 2014 at 6:17 PM
Hmmmm, well that's strange since I don't (think I) use any of the Azure SDK functionality. I'll continue looking into this, but thanks for letting myself and others know of a potential solution in the mean time.
Jul 25, 2014 at 2:50 PM
I have tried with a vanilla solution and updated Azure SDK for .NET v2.3 and it still doesn't work.

Any suggestions on what i can try next?
Jul 25, 2014 at 3:07 PM
Maybe try install Azure PowerShell?
Coordinator
Jul 25, 2014 at 3:18 PM
@richRubie can you please post the full text from the Output window, as cadditon did above? Also, I assume you are using the latest version, v1.8.1?
Jul 28, 2014 at 3:00 AM
I get the same error.

Here is a paste from my Build Output: http://pastebin.com/5DRvyeCz
Coordinator
Jul 28, 2014 at 2:20 PM
Another person with PowerShell 2. If you are running Windows 7 or greater and are willing, could you try installing either PowerShell v3.0 or PowerShell v4.0 and let me know if you still get the error please.

Also, can you double check that the .nupkg file doesn't get created, even though you get an error. The problem might just be with the way that I detect that the NuGet package was created, and not the actual creation of the package itself.
Jul 29, 2014 at 2:45 AM
Sorry, I should have been clear - the .nupkg DOES get created, everything works fine - i'm just left with this build error.

I am running Windows 7, and have gone ahead and installed PowerShell v4.0.
Hey Presto - cannot reproduce the error now.
Jul 29, 2014 at 8:02 AM
Hi,

Sorry for the late reply.

The package was created but now i have installed powershell 3 it works.

Thanks for your time.
Coordinator
Jul 29, 2014 at 4:06 PM
Edited Jul 29, 2014 at 4:07 PM
Thanks for confirming guys. It looks like my initial suspicion about it being a PowerShell v2 problem was correct. Once I get a bit of time I'll take a look at how I can make the script PowerShell v2 compatible again. For now if people run into this they will just need to upgrade their PowerShell version using the download links I posted in my last response. Thanks.
Coordinator
Aug 9, 2014 at 10:30 PM
Ok, I believe this should be fixed now in v1.5.2 of the script, and v1.8.2 of the NuGet Package. It looks like the problem is with the -OutVariable parameter on Invoke-Expression; it works properly on PS 3.0 and up, but was always blank on PS v2.0. Thanks everyone :)
Marked as answer by deadlydog on 8/9/2014 at 3:30 PM