Skip to content

Changing Target Framework #672

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DanJBower opened this issue May 14, 2022 · 4 comments
Open

Changing Target Framework #672

DanJBower opened this issue May 14, 2022 · 4 comments

Comments

@DanJBower
Copy link

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
Copy link
Author

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

@awa5114
Copy link

awa5114 commented Jun 2, 2023

@DanJBower Did you end up figuring this out? I'm trying to do the same thing in #729, except I'm doing it from the command line (i.e. not vs code)

@DanJBower
Copy link
Author

@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

@Rijno
Copy link

Rijno commented Feb 29, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants