Vscode-code-runner: [REQUEST] CSCおよびVBCコンパイラを指定するための設定

作成日 2017年01月20日  ·  4コメント  ·  ソース: formulahendry/vscode-code-runner

こんにちは。

まず、VB.NETのサポートを追加してくれた作者に感謝します。

VS Code / Code Runnerのsettings.jsonに2つの設定を実装して、CSCおよびVBCコンパイラのディレクトリパスを指定できるかどうかを確認したいと思います(さらに良いのは、MSBUILDディレクトリを指定する単一の設定だけです)。また、CSCコンパイラとVBCコンパイラが存在すると想定します。これは、両方のコンパイラが、VisualStudioによってインストールされるデフォルトで常に存在するためです。

ユーザーにPATH環境変数にディレクトリパスを追加するように強制することは、少し煩わしくて面倒だと思います。その場合、この設定の実装は、その観点からはるかに優れています(そして移植可能です)。

PS:英語が下手でごめんなさい。

読んでくれてありがとう!

fyi

最も参考になるコメント

空白を含むファイル名の問題を回避する構成を共有したいだけです。

  "code-runner.executorMap": {
        "csharp": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\csc.exe\" /nologo \"$fileName\" && \"$fileNameWithoutExt.exe\""
  },
  "code-runner.executorMapByFileExtension": { 
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo \"$fileName\" && \"$fileNameWithoutExt.exe\""
  } 

さらに、C#およびVB.NETのコンパイルを完全に体験したい場合は、以下のこの構成により、C:WindowsTempディレクトリにコンパイルされ(ジャンク実行可能ファイルの生成を回避するため)、デバッグファイル情報とXmlドキュメントファイルが生成されます。時間と頭痛の種を節約するための重要なアセンブリ。これにより、デバッグコンパイラの設定が最適化され、コンパイルと分析がより堅牢になります(これは、VisualStudioのプロジェクトファイル.vbproj / .csprojで使用する構成と同じ参照およびインポート/使用構成です。デフォルト):

  "code-runner.executorMap": {
        "csharp": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\csc.exe\" /nologo /preferreduilang:en-US /debug:full /warn:4 /doc:\"C:\\Windows\\Temp\\vs-code-runner.csharp.xml\" /reference:\"System.dll\",\"System.Core.dll\",\"System.Data.dll\",\"System.Data.DataSetExtensions.dll\",\"System.Deployment.dll\",\"System.DirectoryServices.AccountManagement.dll\",\"System.Drawing.dll\",\"System.Management.dll\",\"System.Net.dll\",\"System.Net.Http.dll\",\"System.Windows.Forms.dll\",\"System.Xml.dll\",\"System.Xml.Linq.dll\" /platform:anycpu /target:exe /out:\"C:\\Windows\\Temp\\vs-code-runner.csharp.exe\" \"$fileName\" && \"C:\\Windows\\Temp\\vs-code-runner.csharp.exe\""
  },
  "code-runner.executorMapByFileExtension": { 
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo /vbruntime+ /optionexplicit+ /optionstrict+ /optioninfer- /debug:full /verbose- /doc:\"C:\\Windows\\Temp\\vs-code-runner.vbnet.xml\" /reference:\"System.dll\",\"System.Core.dll\",\"System.Data.dll\",\"System.Data.DataSetExtensions.dll\",\"System.Deployment.dll\",\"System.DirectoryServices.AccountManagement.dll\",\"System.Drawing.dll\",\"System.Management.dll\",\"System.Net.dll\",\"System.Net.Http.dll\",\"System.Windows.Forms.dll\",\"System.Xml.dll\",\"System.Xml.Linq.dll\" /imports:\"Microsoft.VisualBasic\",\"Microsoft.Win32\",\"Microsoft.Win32.SafeHandles\",\"System\",\"System.Collections\",\"System.Collections.Concurrent\",\"System.Collections.Generic\",\"System.Collections.ObjectModel\",\"System.ComponentModel\",\"System.Data\",\"System.Diagnostics\",\"System.DirectoryServices.AccountManagement\",\"System.Drawing\",\"System.Globalization\",\"System.IO\",\"System.IO.MemoryMappedFiles\",\"System.Linq\",\"System.Linq.Expressions\",\"System.Management\",\"System.Net\",\"System.Reflection\",\"System.Resources\",\"System.Runtime.CompilerServices\",\"System.Runtime.InteropServices\",\"System.Runtime.Serialization\",\"System.Security.AccessControl\",\"System.Security.Permissions\",\"System.Security.Principal\",\"System.Text\",\"System.Text.RegularExpressions\",\"System.Threading\",\"System.Threading.Tasks\",\"System.Web\",\"System.Windows.Forms\",\"System.Xml\",\"System.Xml.Linq\",\"System.Xml.Serialization\" /platform:anycpu /target:exe /out:\"C:\\Windows\\Temp\\vs-code-runner.vbnet.exe\" \"$fileName\" && \"C:\\Windows\\Temp\\vs-code-runner.vbnet.exe\""
  } 

みなさん、良い一日を。

全てのコメント4件

すでにサポートされています//github.com/formulahendry/vscode-code-runner#configuration
File > Preferences -> User Settings 、settings.jsonを開いて、次のように設定します。

{
    "code-runner.executorMapByFileExtension": {
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo $fileName && $fileNameWithoutExt"
    } 
}

どうもありがとうございます。

これが適切な構文と設定の配置であるかどうかを確認してください。

// Place your settings in this file to overwrite the default settings
{
  // Default vs-code settings goes here...
  // ...

  // Code-runner extension: Compiler settings
  "code-runner.executorMapByFileExtension": { 
        ".cs": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\csc.exe\" /nologo $fileName && $fileNameWithoutExt",
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo $fileName && $fileNameWithoutExt"
  } 
}

そうです。
csファイルの場合、C#拡張機能をインストールしている場合は、次のように設定する必要があります。

{
  "code-runner.executorMap": {
        "csharp": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\csc.exe\" /nologo $fileName && $fileNameWithoutExt"
  },
  "code-runner.executorMapByFileExtension": { 
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo $fileName && $fileNameWithoutExt"
  } 
}

空白を含むファイル名の問題を回避する構成を共有したいだけです。

  "code-runner.executorMap": {
        "csharp": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\csc.exe\" /nologo \"$fileName\" && \"$fileNameWithoutExt.exe\""
  },
  "code-runner.executorMapByFileExtension": { 
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo \"$fileName\" && \"$fileNameWithoutExt.exe\""
  } 

さらに、C#およびVB.NETのコンパイルを完全に体験したい場合は、以下のこの構成により、C:WindowsTempディレクトリにコンパイルされ(ジャンク実行可能ファイルの生成を回避するため)、デバッグファイル情報とXmlドキュメントファイルが生成されます。時間と頭痛の種を節約するための重要なアセンブリ。これにより、デバッグコンパイラの設定が最適化され、コンパイルと分析がより堅牢になります(これは、VisualStudioのプロジェクトファイル.vbproj / .csprojで使用する構成と同じ参照およびインポート/使用構成です。デフォルト):

  "code-runner.executorMap": {
        "csharp": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\csc.exe\" /nologo /preferreduilang:en-US /debug:full /warn:4 /doc:\"C:\\Windows\\Temp\\vs-code-runner.csharp.xml\" /reference:\"System.dll\",\"System.Core.dll\",\"System.Data.dll\",\"System.Data.DataSetExtensions.dll\",\"System.Deployment.dll\",\"System.DirectoryServices.AccountManagement.dll\",\"System.Drawing.dll\",\"System.Management.dll\",\"System.Net.dll\",\"System.Net.Http.dll\",\"System.Windows.Forms.dll\",\"System.Xml.dll\",\"System.Xml.Linq.dll\" /platform:anycpu /target:exe /out:\"C:\\Windows\\Temp\\vs-code-runner.csharp.exe\" \"$fileName\" && \"C:\\Windows\\Temp\\vs-code-runner.csharp.exe\""
  },
  "code-runner.executorMapByFileExtension": { 
        ".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo /vbruntime+ /optionexplicit+ /optionstrict+ /optioninfer- /debug:full /verbose- /doc:\"C:\\Windows\\Temp\\vs-code-runner.vbnet.xml\" /reference:\"System.dll\",\"System.Core.dll\",\"System.Data.dll\",\"System.Data.DataSetExtensions.dll\",\"System.Deployment.dll\",\"System.DirectoryServices.AccountManagement.dll\",\"System.Drawing.dll\",\"System.Management.dll\",\"System.Net.dll\",\"System.Net.Http.dll\",\"System.Windows.Forms.dll\",\"System.Xml.dll\",\"System.Xml.Linq.dll\" /imports:\"Microsoft.VisualBasic\",\"Microsoft.Win32\",\"Microsoft.Win32.SafeHandles\",\"System\",\"System.Collections\",\"System.Collections.Concurrent\",\"System.Collections.Generic\",\"System.Collections.ObjectModel\",\"System.ComponentModel\",\"System.Data\",\"System.Diagnostics\",\"System.DirectoryServices.AccountManagement\",\"System.Drawing\",\"System.Globalization\",\"System.IO\",\"System.IO.MemoryMappedFiles\",\"System.Linq\",\"System.Linq.Expressions\",\"System.Management\",\"System.Net\",\"System.Reflection\",\"System.Resources\",\"System.Runtime.CompilerServices\",\"System.Runtime.InteropServices\",\"System.Runtime.Serialization\",\"System.Security.AccessControl\",\"System.Security.Permissions\",\"System.Security.Principal\",\"System.Text\",\"System.Text.RegularExpressions\",\"System.Threading\",\"System.Threading.Tasks\",\"System.Web\",\"System.Windows.Forms\",\"System.Xml\",\"System.Xml.Linq\",\"System.Xml.Serialization\" /platform:anycpu /target:exe /out:\"C:\\Windows\\Temp\\vs-code-runner.vbnet.exe\" \"$fileName\" && \"C:\\Windows\\Temp\\vs-code-runner.vbnet.exe\""
  } 

みなさん、良い一日を。

このページは役に立ちましたか?
0 / 5 - 0 評価