oleg-shilo / cs-script

C# scripting platform
http://www.cs-script.net
MIT License
1.57k stars 234 forks source link

problem with .net 7 sdk #323

Closed allebonvi closed 1 year ago

allebonvi commented 1 year ago

Hi all, install cs-script with choco: CS-Script 4.6.4.0 then upgreade to .net sdk 7.0.3 as required running cscs in cli C:\devel\c#scripting\scripts>cscs C# Script execution engine (.NET Core). Version 4.6.4.0. Copyright (C) 2004-2020 Oleg Shilo. www.csscript.net (github.com/oleg-shilo/cs-script)

CLR: 7.0.3 System: Microsoft Windows NT 10.0.19045.0 Architecture: x64 Install dir: C:\ProgramData\chocolatey\lib\cs-script\tools Script engine: C:\ProgramData\chocolatey\lib\cs-script\tools\cscs.dll Compiler engine: dotnet (C:\Program Files\dotnet\dotnet.exe) NuGet manager: dotnet NuGet cache: C:\Users\abonvicini.nuget\packages Custom commands: C:\ProgramData\cs-script\commands Global includes: C:\ProgramData\chocolatey\lib\cs-script\tools\cs-script\inc

then create a script with cscs -new hello.cs whose content is //css_include global-usings

"------------------------------------".print(); Console.WriteLine($"Date: {DateTime.Now}"); (string message, int version) setup_say_hello() { return ("Hello from C#", 9); }

var info = setup_say_hello();

print(info.message, info.version);

print(Environment.GetEnvironmentVariables() .Cast() .Take(5)); "------------------------------------".print();

In the end I issue css hello.css and then ERROR C:\Program Files\dotnet\sdk\7.0.200\Current\SolutionFile\ImportAfter\Microsoft.NET.Sdk.Solution.targets(36,5): error NETSDK1194: l'opzione "--output" non è supportata durante la compilazione di una soluzione.

Ideas????

Thank a lot Aelssandro

oleg-shilo commented 1 year ago

I cannot fully understand the error message. It's not in English. But it looks like there is some change in the .net CLI in that version of .NET and it no longer supports --output argument.

I will need to investigate it but for now you can try to switch to the alternative compiling engine: css -ng:csc hello.cs

oleg-shilo commented 1 year ago

Just repeated your test case with v7.0.4

It seems like there is no problem with that.

image

Though I have noticed that in your case the process is still picking the old SDK: "C:\Program Files\dotnet\sdk\7.0.200"