.net 在此构建过程中,“以代码 9009 退出”是什么意思?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1351830/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 13:14:26  来源:igfitidea点击:

What does "exited with code 9009" mean during this build?

.netvisual-studio

提问by

What does this error message mean? What could I do to correct this issue?

这个错误信息是什么意思?我能做些什么来纠正这个问题?

AssemblyInfo.cs exited with code 9009

AssemblyInfo.cs 退出,代码为 9009



The problem is probably happening as part of a post-build step in a .NET solution in Visual Studio.

该问题可能发生在 Visual Studio 中 .NET 解决方案的构建后步骤中。

回答by thehhv

Did you try to give the full path of the command that is running in the pre- or post-build event command?

您是否尝试提供在构建前或构建后事件命令中运行的命令的完整路径?

I was getting the 9009 error due to a xcopypost-build event command in Visual Studio 2008.

由于xcopyVisual Studio 2008 中的生成后事件命令,我收到了 9009 错误。

The command "xcopy.exe /Y C:\projectpath\project.config C:\compilepath\"exited with code 9009.

命令"xcopy.exe /Y C:\projectpath\project.config C:\compilepath\"退出,代码为 9009。

But in my case it was also intermittent. That is, the error message persists until a restart of the computer, and disappears after a restart of the computer. It is back after some remotely related issue I am yet to discover.

但就我而言,它也是间歇性的。也就是说,错误消息会一直持续到计算机重新启动,并在计算机重新启动后消失。在我尚未发现的一些远程相关问题之后,它又回来了。

However, in my case providing the command with its full path solved the issue:

但是,在我的情况下,提供带有完整路径的命令解决了这个问题:

c:\windows\system32\xcopy.exe /Y C:\projectpath\project.config C:\compilepath\ 

Instead of just:

而不仅仅是:

xcopy.exe /Y C:\projectpath\project.config C:\compilepath\

If I do not have the full path, it runs for a while after a restart, and then stops.

如果我没有完整路径,它会在重新启动后运行一段时间,然后停止。

Also as mentioned on the comments to this post, if there are spacesin full path, then one needs quotation marks around the command. E.g.

同样如对这篇文章的评论所述,如果完整路径中有空格,则需要在命令周围加上引号。例如

"C:\The folder with spaces\ABCDEF\xcopy.exe" /Y C:\projectpath\project.config C:\compilepath\

Note that this example with regards to spaces is not tested.

请注意,这个关于空格的例子没有经过测试。

回答by Chris Moschini

Error Code 9009 means error file not found. All the underlying reasons posted in the answers here are good inspiration to figure out why, but the error itself simply means a bad path.

错误代码 9009 表示未找到错误文件。此处答案中发布的所有根本原因都是找出原因的好灵感,但错误本身仅意味着一条糟糕的道路。

回答by HRKoder

It happens when you are missing some environment settings for using Microsoft Visual Studio x86 tools.
Therefore, try adding as a first command in your post-build steps:

当您缺少使用 Microsoft Visual Studio x86 工具的某些环境设置时会发生这种情况。
因此,尝试在构建后步骤中将其添加为第一个命令:

For Visual Studio 2010 use:

对于 Visual Studio 2010 使用:

call "$(DevEnvDir)..\Tools\vsvars32.bat"

As @FlorianKoch mentioned in comments, for VS 2017 use:

正如@FlorianKoch 在评论中提到的,对于 VS 2017 使用:

call "$(DevEnvDir)..\Tools\VsDevCmd.bat"

It should be placed before any other command.
It will set environment for using Microsoft Visual Studio x86 tools.

它应该放在任何其他命令之前。
它将设置使用 Microsoft Visual Studio x86 工具的环境。

回答by NileshChauhan

Most probably you have space in your resultant path.

很可能你的结果路径中有空间。

You can work around this by quoting the paths, thus allowing spaces. For example:

您可以通过引用路径来解决此问题,从而允许使用空格。例如:

xcopy "$(SolutionDir)\Folder Name\File To Copy.ext" "$(TargetDir)" /R /Y /I

回答by Radomir Szewczyk

Had the same variable after changing PATH variable from Environmental Variables in Win 7. Changing back to default helped.

在 Win 7 中从环境变量更改 PATH 变量后具有相同的变量。更改回默认值有帮助。

回答by SleepyBoBos

I have had the error 9009 when my post build event script was trying to run a batch file that did not exist in the path specified.

当我的后期构建事件脚本试图运行指定路径中不存在的批处理文件时,我遇到了错误 9009。

回答by scw

My exact error was

我的确切错误是

The command "iscc /DConfigurationName=Debug "C:\Projects\Blahblahblah\setup.iss"" exited with code 9009.

The command "iscc /DConfigurationName=Debug "C:\Projects\Blahblahblah\setup.iss"" exited with code 9009.

9009 means file not found, but it actually couldn't find the "iscc" part of the command.

9009 表示找不到文件,但实际上找不到命令的“iscc”部分。

I fixed it by adding ";C:\Program Files\Inno Setup 5 (x86)\"to the system environment variable "path"

我通过添加";C:\Program Files\Inno Setup 5 (x86)\"到系统环境变量来修复它"path"

回答by GregC

I caused this error to happen when I redacted my Path environment variable. After editing, I accidentally added Path=to the beginning of the path string. With such a malformed path variable, I was unable to run XCopy at the command line (no command or file not found), and Visual Studio refused to run post-build step, citing error with code 9009.

我在编辑 Path 环境变量时导致发生此错误。编辑后,不小心加到Path=了路径字符串的开头。使用这种格式错误的路径变量,我无法在命令行运行 XCopy(未找到命令或文件),并且 Visual Studio 拒绝运行构建后步骤,引用错误代码 9009。

XCopy commonly resides in C:\Windows\System32. Once the Path environment variable allowed XCopy to get resolved at DOS prompt, Visual Studio built my solution well.

XCopy 通常驻留在 C:\Windows\System32 中。一旦 Path 环境变量允许 XCopy 在 DOS 提示符下得到解析,Visual Studio 就很好地构建了我的解决方案。

回答by Mathias Lykkegaard Lorenzen

In my case I had to "CD" (Change Directory) to the proper directory first, before calling the command, since the executable I was calling was in my project directory.

在我的情况下,在调用命令之前,我必须先“CD”(更改目录)到正确的目录,因为我正在调用的可执行文件在我的项目目录中。

Example:

例子:

cd "$(SolutionDir)"
call "$(SolutionDir)build.bat"

回答by Mark

Check the spelling. I was trying to call an executable but had the name misspelled and it gave me the exited with code 9009message.

检查拼写。我试图调用一个可执行文件,但名称拼写错误,它给了我exited with code 9009消息。