Open gw-ubunye opened 1 year ago
Yes, it is possible even though not directly. The extension is designed to support .NET Core family runtimes and is distributed with the script engine CS-Script targeting exactly that runtime. All services like auto-completion, go-to-definition et. are all targeting this runtimes.
Though you can change the execution engine, specifically, you can download the .NET Framework edition of CS-Script and point VSCode to it.
Thus your intellisense (syntax services) will be running in VSCode on .NET Core, which is fine. Your script type model is the same regardless of the runtime model. But the script execution will be done under .NET Framework.
You can download .NETFramework CS-SCript from here.
And you will need to set VSCode extension Cscs_exe value to the location of the downloaded and extracted cscs.exe
here:
Thank you for the reply, Oleg. We are not able to get this working though. When setting the Cscs path to, "C:\Binaries_for_DOTNET_4.8\cscs.exe" in my case, nothing happens when running a script. When you try to run it a second time, it pops up with a "CS-Script is busy".
I have the .Net framework 4.8 SDK installed.
can you please try to execute the script from the terminal:
"C:\Binaries_for_DOTNET_4.8\cscs.exe" <path to your script>
This is to check that the problem of cscs.exe handing is caused by some execution runtime problem the extension does not catch.
I can execute the script without issue using the command line.
Then it means that it only hangs when you execute it via VSCode launcher (F%). Thus I suggest you edit the script in VSCode but execute it in the terminal.
I have dug a bit deeper and indeed setting Cscs path will not help as the extension is still treating the assembly you specified as a .NET Core assembly and tries execute it via dotnet launcher:
dotnet <cscs.exe> <your script>
And dotnet.exe
cannot recover from an attempt to load .NET Framework assembly.
You can probably automate it with some extensions (e.g. Command launcher).
Hmm. Ok. How does this impact the debug experience though?
I also noticed that code completion does not work properly.
To be clear, and just to make sure I don't have environmental issues, what I need are:
What I want to be able to do, is to write and debug scripts which reference 32bit, .Net Framework 4.8 assemblies. With syntax highlighting and code completion.
Judging from your last message, I misunderstood your requests and assumed you only want to execute your script under .NET but the rest of VSCode experience is less important. So let me clarify all that.
The current version of the extension targets .NET Core. This applies to all aspects Intellisense, debugging and execution.
Thus if you develop .NET Fx code then intellisense can be impacted, debugging and execution will just fail.
Where does it leave you?
You can install an older version of the extension that targets .NET Framework natively: cs-script-1.5.12.vsix (Mar 2020). But since it is 4 years old it may not work as it did at the time.
I personally use Sublime Text with cs-script extension to edit my all scripts against .NET Core runtime. But for the execution I use a specific engine (.NET Framework or .NET Core).
And for debugging, I simply execute the script with the //x
argument at the end of the command line:
cscs <my script> //x
This will trigger a deliberate assertion in the engine assembly and you will be prompted to attach the system debugger.
Confirm it, then F11 and you are in. Debugging with the full power of VS
Understood. Thank you for taking the time to clarify it all.
You can also use Notepad++ the same way as Sublime Text:
But debugging.NET Framework is still only available under VS.
Does this extension support .Net Framework 4.8? If so, what are the steps to do so?