Skip to content
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

Is https://github.com/AvaloniaUI/avalonia-dotnet-templates/blob/master/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj intentionally targetting .NET standard 2.0 while all platform specific projects target .NET 6.0? #92

Closed
martin-honnen opened this issue May 7, 2022 · 2 comments · Fixed by #107

Comments

@martin-honnen
Copy link

I have tried to use the xplat template and was kind of surprised that the main project https://github.com/AvaloniaUI/avalonia-dotnet-templates/blob/master/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj has <TargetFramework>netstandard2.0</TargetFramework> while all the platform specific projects like https://github.com/AvaloniaUI/avalonia-dotnet-templates/blob/master/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj use .NET 6 e.g. <TargetFramework>net6.0-android</TargetFramework> or https://github.com/AvaloniaUI/avalonia-dotnet-templates/blob/master/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj has e.g. <TargetFramework>net6.0</TargetFramework>.

As the development, after creating a new project based on the template with e.g. dotnet new avalonia.xplat, happens on the main project where I, for instance, then tried to add a NuGet package written for .NET 5, I got a message that the package is not compatible with .NET standard 2.0. I had to edit the main project's TargetFramework before being able to add and use the NuGet package.

I am wondering what the reason is for having the main project use <TargetFramework>netstandard2.0</TargetFramework> although the dedicated projects derived from it all use .NET 6. Is there any advantage to use <TargetFramework>netstandard2.0</TargetFramework>? I think that is not in any way compatible with .NET 6.

@maxkatz6
Copy link
Member

maxkatz6 commented May 8, 2022

I think that is not in any way compatible with .NET 6.

Of course it is.
There is no problem with using "netstandard2.0" project/package from the "net6.0" project.
And before it was the only one possible way to multitarget, when not everything could use "net6.0" (like, legacy xamarin).

@maxkatz6
Copy link
Member

maxkatz6 commented May 8, 2022

You are free to change target framework to whatever you want.

But since 6.0 now is LTS version, we probably can use it exclusively in our packages as well. So, it makes sense to update templates.

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

Successfully merging a pull request may close this issue.

2 participants