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

AssemblyInfo.cs退出,代码为9009


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


当前回答

我通过简单地重新启动Visual Studio来解决这个问题——我刚刚在控制台窗口中运行了dotnet工具安装xxx, VS还没有选择新的环境变量和/或路径设置,所以快速重新启动解决了这个问题。

其他回答

仔细检查Output选项卡。

这应该能揭示问题的原因。

(例如,在我的例子中,它与注释有关:'#'不能被识别为内部或外部命令,可操作的程序或批处理文件。)

在我的案例中,问题发生在我试图在命令行上为测试类库中的Post-build事件使用命令时。当你像这样使用引号时:

"$(SolutionDir)\packages\NUnit.Runners.2.6.2\tools\nunit" "$(TargetPath)" 

或者如果你使用控制台:

"$(SolutionDir)\packages\NUnit.Runners.2.6.2\tools\nunit-console" "$(TargetPath)"

这为我解决了问题。

如果脚本确实做了它需要做的事情,而Visual Studio只是因为错误而困扰你,你可以添加:

exit 0

到你剧本的结尾。

我也有类似的问题,我收到了:

命令 ”“C: \ <用户> \用户下载\ XmlDoc2CmdletDoc.0.3.0 \建立. . \ \ sandbox-attacksurface-analysis-tools-c02ed8ba04324e54a0a188ab9877ee6aa372dfac \包工具” C:\Users<user>\Downloads\sandbox-attack - surface-analysis-tools-c02ed8ba04324e54a0a188ab9877ee6aa372dfac\bin\Debug\NtObjectManager.dll" 用代码9009退出。

我当到项目属性>构建和检查XML文档文件:

在那之后,我重建了这个项目,但它消失了。奇怪的是,在我再次选中复选框并重新构建它之后,错误没有返回。 重影故障. .

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.