ماذا يعني "الخروج مع الكود 9009" خلال هذا البناء؟

StackOverflow https://stackoverflow.com/questions/1351830

  •  20-09-2019
  •  | 
  •  

سؤال

ماذا تعني رسالة الخطأ هذه؟ ماذا يمكنني أن أفعل لتصحيح هذه المشكلة؟

خرجت AssemblyInfo.cs بالرمز 9009


ربما تحدث المشكلة كجزء من خطوة ما بعد البناء في حل .NET في Visual Studio.

لا يوجد حل صحيح

نصائح أخرى

هل حاولت إعطاء المسار الكامل للأمر الذي يتم تشغيله في أمر الحدث قبل أو ما بعد البناء؟

كنت أحصل على خطأ 9009 بسبب أ xcopy أمر حدث ما بعد البناء في Visual Studio 2008.

الامر "xcopy.exe /Y C:\projectpath\project.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\

لاحظ أنه لم يتم اختبار هذا المثال فيما يتعلق بالمساحات.

رمز الخطأ 9009 يعني ملف الخطأ لم يتم العثور عليه. جميع الأسباب الأساسية المنشورة في الإجابات هنا هي مصدر إلهام جيد لمعرفة السبب ، لكن الخطأ نفسه يعني ببساطة مسارًا سيئًا.

يحدث ذلك عندما تفتقد بعض إعدادات البيئة لاستخدام أدوات Microsoft Visual Studio X86.
لذلك ، حاول إضافة أمر أولي في خطوات ما بعد البناء:

لاستخدام Visual Studio 2010:

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

كما ذكر @floriankoch في التعليقات ، ل VS 2017 الاستخدام:

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

يجب وضعه قبل أي أمر آخر.
سيعين بيئة لاستخدام أدوات Microsoft Visual Studio X86.

على الأرجح لديك مساحة في طريقك الناتج.

يمكنك العمل حول هذا من خلال اقتباس المسارات ، وبالتالي السماح بالمساحات. فمثلا:

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

كان لديه نفس المتغير بعد تغيير متغير المسار من المتغيرات البيئية في Win 7. ساعدت العودة إلى الافتراضي ساعد.

لقد كان لدي خطأ 9009 عندما كان برنامج Post Build Event Script يحاول تشغيل ملف دفعي لم يكن موجودًا في المسار المحدد.

لقد تسببت في حدوث هذا الخطأ عندما قمت بتخفيض متغير بيئة المسار. بعد التحرير ، أضفت عن طريق الخطأ Path= إلى بداية سلسلة المسار. مع مثل هذا المتغير المسار المشوه ، لم أتمكن من تشغيل Xcopy في سطر الأوامر (لم يتم العثور على أمر أو ملف) ، ورفض Visual Studio تشغيل خطوة ما بعد البناء ، مشيرًا إلى خطأ في الكود 9009.

Xcopy يقيم عادة في C: Windows System32. بمجرد أن يسمح متغير بيئة المسار بـ Xcopy بمحلول DOS ، قام Visual Studio ببناء الحل جيدًا.

إذا كان البرنامج النصي يقوم فعليًا بما يجب أن يفعله وهو مجرد استوديو مرئي يزعجك بشأن الخطأ الذي يمكنك إضافته فقط:

exit 0

إلى نهايتك السيناريو.

تحقق من الإملاء. كنت أحاول استدعاء قابلة للتنفيذ ولكن كان اسم أخطاء إملائية وأعطاني exited with code 9009 رسالة.

في حالتي ، اضطررت إلى "CD" (دليل التغيير) إلى الدليل المناسب أولاً ، قبل استدعاء الأمر ، لأن القابل للتنفيذ الذي كنت أتصل به كان في دليل المشروع الخاص بي.

مثال:

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

كان خطأي الدقيق

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

9009 يعني ملف لم يتم العثور عليه ، لكنه في الواقع لم يتمكن من العثور على جزء "ISCC" من الأمر.

لقد أصلحته بإضافة ";C:\Program Files\Inno Setup 5 (x86)\" إلى متغير بيئة النظام "path"

متغير آخر:

اليوم أدعو Python مترجم من CRON في Win32 وأخذ Exitcode (٪ errorlevel ٪) 9009 ، لأن حساب النظام المستخدم من قبل CRON ليس لديه طريق إلى Python Directory.

حدثت المشكلة في حالتي عندما حاولت استخدام أمر على سطر الأوامر لحدث ما بعد البناء في مكتبة فئة الاختبار الخاصة بي. عندما تستخدم علامات اقتباس مثل ذلك:

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

أو إذا كنت تستخدم وحدة التحكم:

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

هذا إصلاح القضية بالنسبة لي.

Also, make sure there are no line breaks in the post build event editing window on your project. Sometimes copying the xcopy command from the web when it's multi-line and pasting it into VS will cause a problem.

I added "> myFile.txt" to the end of the line in the pre-build step and then inspected the file for the actual error.

tfa's answer has been downvoted, but actually can cause this issue. Thanks to hanzolo, I looked in the output window and found the following:

3>'gulp' is not recognized as an internal or external command,
3>operable program or batch file.
3>D:\dev\<filepath>\Web.csproj(4,5): error MSB3073: The command "gulp clean" exited with code 9009.

After running npm install -g gulp, I stopped getting this error. If you're getting this error in Visual Studio, check the output window and see if the issue is an unset environment variable.

For me, disk space was low, and files that couldn't be written were expected to be present later. Other answers mentioned missing files (or misnamed/improperly referenced-by-name files)--but the root cause was lack of disk space.

Yet another variant of file not found, because of spaces in the path. In my case in the msbuild script. I needed to use HTML style &quot; strings within the exec command.

<!-- Needs quotes example with my Buildscript.msbuild file --> 
<Exec Command="&quot;$(MSBuildThisFileDirectory)\wix\wixscript.bat&quot; $(VersionNumber) $(VersionNumberShort)" 
    ContinueOnError="false" 
    IgnoreExitCode="false" 
    WorkingDirectory="$(MSBuildProjectDirectory)\wix" />

Same as the other answers, in my case it was because of the missing file. To know what is the missing file, you can go to the output window and it will show you straight away what went missing.

To open the output window in Visual Studio:

  1. Ctrl+Alt+O
  2. View > Output

enter image description here

I fixed this by simply restarting Visual Studio - I had just run dotnet tool install xxx in a console window and VS hadn't yet picked up the new environment variables and/or path settings that were changed, so a quick restart fixed the issue.

This is pretty basic, I had this problem, and embarrassing simple fail.

Application use Command line arguments, I removed them and then added them back. Suddenly the project failed to build.

Visual Studio -> Project Properties -> verify that you use 'Debug' tab (not 'Build Events' tab) -> Command Line Arguments

I used the and Post/Pre-build text area, which was wrong this case.

For me it happened after upgrade nuget packages from one PostSharp version to next one in a big solution (~80 project). I've got compiler errors for projects that have commands in PreBuild events.

'cmd' is not recognized as an internal or external command, operable program or batch file. C:\Program Files (x86)\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1249,5): error MSB3073: The command "cmd /c C:\GitRepos\main\ServiceInterfaces\DEV.Config\PreBuild.cmd ServiceInterfaces" exited with code 9009.

PATH variable was corrupted becoming too long with multiple repeated paths related to PostSharp.Patterns.Diagnostics. When I closed Visual Studio and opened it again, the problem was fixed.

My solution was just simple as: have you tried turning it off and on again? So I restarted the computer and the issue was gone.

I also ran into this 9009 problem when facing an overwrite situation.

Basically, if the file already exists and you have not specified the /y switch (which automatically overwrites) this error can happen when run from a build.

Actually I noticed that for some reason the %windir% environment variable sometimes get erased. What worked for me was re-set the windir environment variable to c:\windows, restart VS, and that's it. That way you prevent having to modify the solution files.

At least in Visual Studio Ultimate 2013, Version 12.0.30723.00 Update 3, it's not possible to separate an if/else statement with a line break:

works:

if '$(BuildingInsideVisualStudio)' == 'true' (echo local) else (echo server)

doesn't work:

if '$(BuildingInsideVisualStudio)' == 'true' (echo local) 
else (echo server)

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.

I think in my case there were russian symbols in path (all projects were in user folder). When I put solution in another folder (directly on disk), everything became ok.

My solution was to create a copy of the file and add a step to the build task to copy my file over the original.

You need to make sure you have installed grunt globally

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top