Hi.
First of all I want to say thankyou to the author for adding support for VB.NET.
I would like to ask whether it could be possible the implementation of two settings in the settings.json of VS Code/Code Runner to specify the CSC and VBC compiler directory paths (or even better, just a single setting where to specify the MSBUILD dir and assume CSC and VBC compilers are there, because both compilers are always there by the default installed by Visual Studio).
I consider that forcing the user to have the directory path added to the PATH environment variable is a little bit intrusive and bothering, then, the implementation of this setting would be much better (and portabilizable) in that point of view.
PS: Sorry for my bad English.
Thanks for read!.
It is already supported: https://github.com/formulahendry/vscode-code-runner#configuration
Go to File
> Preferences
-> User Settings
, and open settings.json, and set like below:
{
"code-runner.executorMapByFileExtension": {
".vb": "cd $dir && \"C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\vbc.exe\" /nologo $fileName && $fileNameWithoutExt"
}
}
thankyou so much.
Please could you confirm me whether this is the proper syntax and settings placement?:
// 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"
}
}
That should be right.
For cs file, if you have installed C# extension, you need to set as below:
{
"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"
}
}
I just would like to share a configuration that avoids problems with filenames that contains whitespaces:
"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\""
}
Plus this configuration below if you want to have a full experience compiling for C# and VB.NET, it compiles to C:WindowsTemp directory (to avoid generating junk executable files) and generates debug file info and Xml documentation file, also it references very common and important assemblies to save time and headaches, and it optimizes some debugging compiler settings that makes it more robust for compile and analyze (this is the same references and imports/usings config that I use in my Visual Studio's project files .vbproj/.csproj by default):
"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\""
}
Have a nice day everyone.
Most helpful comment
I just would like to share a configuration that avoids problems with filenames that contains whitespaces:
Plus this configuration below if you want to have a full experience compiling for C# and VB.NET, it compiles to C:WindowsTemp directory (to avoid generating junk executable files) and generates debug file info and Xml documentation file, also it references very common and important assemblies to save time and headaches, and it optimizes some debugging compiler settings that makes it more robust for compile and analyze (this is the same references and imports/usings config that I use in my Visual Studio's project files .vbproj/.csproj by default):
Have a nice day everyone.