问题
I am trying to build the visual studio code and I get the following build error.
I searched for answers regarding the same topic. I already tried adding nuget.exe to Path variable. But nothing seems to work.
This is my error in the error list
MSB3073 The command "nuget.exe push -Source Application_Internal -ApiKey VSTS C:Users\Documents\LOCAL_NUGET_FEED\App.Util.*.*0.0.0*.nupkg" exited with code 9009
The corresponding line from csconfig file is
<Exec Command="NuGet.exe push -Source Application_Internal -ApiKey VSTS $(LOCAL_NUGET_FEED)\$(AssemblyName)*.*$(Version)*.nupkg " />
Any help would be much appreciated.
回答1:
code 9009 : error code MSB3073
Agree with Klaus, 9009 in this situation means the nuget.exe can't be found during the build process. It seems that you have a MSBuild Exec task used to execute the nuget push command.
For msbuild exec task, it actually will call something like cmd.exe to execute the command. So if one command failed in Exec task or post-build-event, most of the time it indicates the command would fail in cmd.exe.
I already tried adding nuget.exe to Path variable
You can open cmd.exe and type nuget, if it displays many switchs about nuget.exe, it means your path variable is set well. But if it shows 'nuget' is not recognized as an internal or external command, it means you didn't add path of nuget.exe to Path Variable successfully. And that's why you got the 9009 in VS.
I Tried it, still getting the same error.
If the same error you mean is 9009, please check content above in #2. If the same error you mean is MSB3073, you need to check the error code, still code 9009 or xxx?
If you simply type nuget in cmd.exe and display many switches, then your path is set well. And I think the code 9009 will go away in VS if you rebuild the project. But it doesn't mean the MSB3073 error would go away. Only if nothing is wrong in your command NuGet.exe push -Source Application_Internal -ApiKey VSTS $(LOCAL_NUGET_FEED)\$(AssemblyName)*.*$(Version)*.nupkg the MSB3073 error would disappear.
For this situation, I mean the nuget.exe can be found. But it may have error when nuget.exe executed the push command, maybe the package not found, source invalid or what.
Note:
1.MSB3073 just means something is wrong with the command. (Perhaps not only one error in the command)
2.code 9009 means the nuget.exe is not found
So you may get MSB3073 and exited code 1 or what even after the nuget.exe can be found. At least for App.Util.*.*0.0.0*.nupkg, I think the nuget.exe didn't find your package.
Suggestion:
Please set the verbosity to Detailed and check the detailed log about why the build failed.
Some possibilities about why you get the MSB3073 after the code 9009 error go away(Examples for code 1):
I think you may get this error message for the wrong use of wildcard $(AssemblyName)*.*$(Version)*.
来源:https://stackoverflow.com/questions/57788333/visual-studio-2017-during-build-exited-with-code-9009-error-code-msb3073