oleg-shilo / cs-script.vscode

VSCode extension for CS-Script
MIT License
37 stars 7 forks source link

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

Closed janmechtel closed 2 years ago

janmechtel commented 2 years ago

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.

oleg-shilo commented 2 years ago

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.

janmechtel commented 2 years ago

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!

oleg-shilo commented 2 years ago

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

janmechtel commented 2 years ago

I can confirm this working again! Thanks!

oleg-shilo commented 2 years ago

perfect. Txs