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

AssemblyInfo.cs退出,代码为9009


这个问题可能是在Visual Studio中的. net解决方案的构建后步骤中发生的。


当前回答

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

由于Visual Studio 2008中的xcopy post-build事件命令,我得到了9009错误。

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

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

然而,在我的情况下,提供命令的完整路径解决了问题:

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

而不仅仅是:

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

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

另外,正如本文评论中提到的,如果全路径中有空格,则需要在命令周围加上引号。如。

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

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

其他回答

很可能在最终路径上有空间。

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

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

这是非常基本的,我遇到过这样的问题,而且是令人尴尬的简单失败。

应用程序使用命令行参数,我删除了它们,然后将它们添加回来。突然,这个项目没能建成。

Visual Studio ->项目属性->验证您使用的是“调试”选项卡(而不是“生成事件”选项卡)->命令行参数

我使用了和Post/Pre-build文本区域,这在这种情况下是错误的。

Yet another reason: If your pre-build event references another projects bin path and you see this error when running msbuild, but not Visual Studio, then you have to manually arrange the projects in the *.sln file (with a text editor) so that the project you are targeting in the event is built before the event's project. In other words, msbuild uses the order that projects are listed in the *.sln file whereas VS uses knowledge of project dependencies. I had this happen when a tool that creates a database to be included in a wixproj was listed after the wixproj.

错误代码9009表示没有找到错误文件。这里的答案中列出的所有潜在原因都是找出原因的好灵感,但错误本身只是意味着错误的路径。

检查拼写。我试图调用一个可执行文件,但有名称拼写错误,它给了我退出与代码9009消息。