2012-11-21 31 views
5

これは重複した質問と思われるかもしれませんが、私は既存の回答をすべて無駄にしてきました。Visual Studio 2012コマンドラインコンパイラ

私は使用しているコンパイラジェネレータにとって必要なので、コマンドプロンプトに対してC#用のコマンドラインコンパイラを認識させようとしています。私は、DreamsparkのVisual Studio 2012賛辞と共に、Windows 7 SP1 64ビットの新規インストールに取り組んでいます。

"Microsoft.NET \ Framework \ v4.0.30319"と "Microsoft.NET \ Framework64 \ v4.0.30319"をパス環境変数に追加しようとしましたが、vsvarsバッチファイルを試しましたが、運。コマンドプロンプトでは、単に "cscが内部コマンドまたは外部コマンドとして認識されない"と記載されています。

助けていただけたら幸いです!

+2

'path'コマンドの出力は正確に何ですか? –

+0

あなたはフルバージョンafaikを取得します。 Visual Studioのコマンドプロンプト、[スタート] + [すべてのプログラム]を使用して見つけます。 –

+0

VS2012用の開発者コマンドプロンプトを使用していますか? 'VsDevCmd.bat'という名前のBatファイルの' C:\ Program Files(x86)\ Microsoft Visual Studio 11.0 \ Common7 \ Tools'を見てください。 –

答えて

6

実際には2つの可能性があります。 1つは、パスが正しくありません。これを試してみてください:

C:\Windows\Microsoft.NET>path 
PATH=C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Micros 
oft Shared\Microsoft Online Services;c:\Program Files (x86)\AMD APP\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C: 
\oraclexe\app\oracle\product\11.2.0\server\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System 
32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Program Files (x86)\Microsoft SQL Server\100\To 
ols\Binn\;c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\P 
rogram Files (x86)\Java\jre6\bin;C:\Program Files (x86)\Graphviz 2.28\bin;C:\Program Files (x86)\1E\SMSNomad\;C:\Program 
Files (x86)\Git\cmd;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\IronRuby 1.1\bin;C:\Program Files\Microsoft\W 
eb Platform Installer\;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\;C:\Program Files\Microsoft SQL S 
erver\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\0.8.0.0\ 

C:\Windows\Microsoft.NET>csc 
'csc' is not recognized as an internal or external command, 
operable program or batch file. 

C:\Windows\Microsoft.NET>set path=%path%;C:\Windows\Microsoft.NET\Framework64\v4.0.30319 

C:\Windows\Microsoft.NET>csc 
Microsoft (R) Visual C# Compiler version 4.0.30319.17929 
for Microsoft (R) .NET Framework 4.5 
Copyright (C) Microsoft Corporation. All rights reserved. 

warning CS2008: No source files specified 
error CS1562: Outputs without source must have the /out option specified 

C:\Windows\Microsoft.NET> 

をそれが機能していない場合は、csc.exeが正しい場所に実際にあることを確認:

C:\Windows\Microsoft.NET>dir C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe /b 
csc.exe 

それが見つからない場合は、やってみてください:

C:\Windows\Microsoft.NET>dir csc.exe /s /b 
C:\Windows\Microsoft.NET\Framework\v1.1.4322\csc.exe 
C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe 
C:\Windows\Microsoft.NET\Framework\v3.5\csc.exe 
C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe 
C:\Windows\Microsoft.NET\Framework64\v2.0.50727\csc.exe 
C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe 
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\csc.exe 

別のディレクトリにあるかどうかを確認します。おそらく、別のバージョンのフレームワークがインストールされているか、64ビットOSがないかもしれません。

+0

dir csc.exe/s/bは以​​下を返します: c:\ Windows \ Microsoft。 c:\ Windows \ Microsoft.NET \ Framework \ v2.0.50727 \ csc.exe c:\ Windows \ Microsoft.NET \ Framework \ v3.5 \ csc.exe c :\ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ csc.exe c:\ Windows \ Microsoft.NET \ Framework64 \ v2.0.50727 \ csc.exe c:\ Windows \ Microsoft.NET \ Framework64 \ v3。 5 \ csc.exe c:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ csc.exe これを設定パス%パス%; C:\ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319長く働くコマンドウィンドウが開いているが、永久には開いていないので、 – Frostie

+0

これは完全にはわからないが、うまく動作しているようだ。 "%SystemRoot%\ System32 \ Wbem;%SYSTEMROOT%\ System32 \ WindowsPowerShell \ v1.0 \"を削除しました。パスから、それは働き始めた。私はもう一度それを追加すると、それは動作を停止します。 – Frostie

+0

@FrostSA - それはむしろ魚のようです。パス内の最初のものとして、 '%SystemRoot%\ Microsoft.NET \ Framework64 \ v4.0.30319'を追加してください。 –

関連する問題