dotnet-script icon indicating copy to clipboard operation
dotnet-script copied to clipboard

Changing Target Framework

Open DanJBower opened this issue 3 years ago • 4 comments

Is there any way to change the target framework for a dotnet-script file?

Currently when I run one of the scripts I've written with dotnet-script MyFile.csx, I think it runs targeting the framework net6.0 but it currently throws an error as the NuGet I'm trying to use requires it to target net6.0-windows. It'd be super helpful to have support for switching to that target

DanJBower avatar May 14 '22 11:05 DanJBower

I've tried placing the following in omnisharp.json but it seems to have no effect

{
  "script": {
    "enableScriptNuGetReferences": true,
    "defaultTargetFramework": "net6.0-windows"
  }
}

I found myself back here today as I require access to System.Xaml, Version=4.0.0.0 but unfortunately that is only available on net6.0-windows instead of net6.0

Sorry if it's really obvious and I've just missed it, but is there any way to change the framework so it targets the windows specific version? This would be super helpful so that I can use the .csx files rather than having to create a normal console app

DanJBower avatar Nov 14 '22 19:11 DanJBower

@DanJBower Did you end up figuring this out? I'm trying to do the same thing in https://github.com/dotnet-script/dotnet-script/issues/729, except I'm doing it from the command line (i.e. not vs code)

awa5114 avatar Jun 02 '23 07:06 awa5114

@DanJBower Did you end up figuring this out?

@amine-aboufirass Unfortunately not. I ended up having to switch to making an exe from a normal C# project

DanJBower avatar Jun 02 '23 08:06 DanJBower

Any plans to implement something like this? It would greatly increase the usefulness of dotnet scripting for me.

Rijno avatar Feb 29 '24 08:02 Rijno