oleg-shilo/cs-script.vscode

Error: Specified file could not be executed. Could not load type 'System.IO.File' from assembly

Closed this issue · 5 comments

CS-Script run script fails with this simple script:

using System.IO;

System.Console.WriteLine(File.Exists(""));

[Running] dotnet "C:\Users\JanMechtel\AppData\Roaming\Code\User\cs-script.user\dotnet\cscs.dll" "c:\Users\JanMechtel\new_script.cs"
Error: Specified file could not be executed.

Could not load type 'System.IO.File' from assembly 'System.Runtime, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.

[Done] exited with code=0 in 4.53 seconds

CS-Script run script after CS-Script: New C# script work fine.

I feel like it's releated to the .net version but I couldn't figure it out.

If I run the same script with css.exe it works fine.

Most likely your donet SDKs are mismatching.
For that version of the extension, you will still need to have .NET 5 runtime/sdk present.
But in a week or so I will be able to bring the integration with the lates (.net6) release of CS-Script.

For that version of the extension, you will still need to have .NET 5 runtime/sdk present.
I tried to install both and the when I inspect the .NET version from the running script it also says "5.0".

In any case I'll wait for the next release. Thanks!

Done. Please find the new release here: https://github.com/oleg-shilo/cs-script.vscode/releases/tag/v2.1.0.0

now you can configure the extension to use any version of CS-Script

I can confirm this working again! Thanks!

perfect. Txs