Closed darkoverlordofdata closed 1 year ago
Can you try installing .NET 7 SDK?
@darkoverlordofdata it seems that you're running a versions of the templates that provide a global.json
file which reverts to .NET 6. You can try to either:
global.json
file (or remove the sdk entry in it) next to the .sln
, or a any folder above the project folder you created.dotnet new install Uno.ProjectTemplates.Dotnet
Adding a global.json had no effect. But it was the template.
In MyApp/MyApp.csproj line 4 I changed
to
and now it works. I can only verify this on Linux.
(don't reply from email. i cleaned up)
Thanks. The log you provided were using the net6.0 SDK, while the app was requesting net7.0. Given that the .NET 7.0 SDK is installed and accessible, the only for this to happen is to have a global.json somewhere in your tree.
If you remove the global.json that you just added, If you run dotnet --version
in your app's folder, what does it show?
I see what happens. Dotnet version 6 is the default version on Ubuntu, so I normally use 6.
When I typed in
dotnet new unoapp -o MyApp -mobile=false --skia-wpf=false --skia-linux-fb=false --vscode
I got a message:
The template "Multi-Platform App (Windows App SDK)" was created successfully.
The current .NET SDK does not support targeting .NET 7.0. Either target .NET 6.0 or lower, or use a version of the .NET SDK that supports .NET 7.0.
My response was the 1st choice, target .NET 6.0 by typing
dotnet new unoapp -o MyApp -mobile=false --skia-wpf=false --skia-linux-fb=false --vscode --framework net6.0
So, I have to follow the 2nd choice, choice 1 doesn’t work. I’ve set my default version to 7.0, and started over, and everything then works.
on your documentation, at https://platform.uno/docs/articles/get-started-dotnet-new.html?tabs=net7%2Cwindows, there are instructions for creating a new template with either donet6 or dotnet7, It says:
NOTE When using .NET 6, use dotnet new -i Uno.Templates instead.
Either the documentation is out of date, or the template is broken.
When I 'tricked' it into using dotnet 6, the resulting application works. If that should be a valid option, as it shows in your documentation, then your template is broken and it should pick whichever is requested.
Thanks for the feedback.
That's unfortunately a limitation of the dotnet new
templating engine with regards to which target is being used by default. We'll adjust the documentation, still, as you can use -f net6.0
to create a net6.0
only solution.
*edit: Actually, the documentation already mentions the -f net6.0
option:
https://github.com/unoplatform/uno/blob/d61288f4a6f3ea128a0b3a5470110266b8466b41/doc/articles/get-started-dotnet-new.md?plain=1#L51
Current behavior
I'm following the instructions at https://platform.uno/docs/articles/get-started-vscode.html?tabs=linux to create a new project, I entered:
I get an error:
So, I added --framework net6.0, and it created correctly. Now I try yo build it:
and I get a new error:
Expected behavior
I'm expecting this to compile correctly.
How to reproduce it (as minimally and precisely as possible)
dotnet new unoapp -o MyAppz -mobile=false --skia-wpf=false --skia-linux-fb=false --vscode --framework net6.0 dotnet build "/home/darko/Documents/GitHub/MyApp/MyApp.Skia.Gtk/MyApp.Skia.Gtk.csproj"
Workaround
No response
Works on UWP/WinUI
None
Environment
No response
NuGet package version(s)
dotnet list package Project 'MyApp' has the following package references [netstandard2.0]: Top-level Package Requested Resolved
Project 'MyApp.Wasm' has the following package references [net6.0]: Top-level Package Requested Resolved
Project 'MyApp.Server' has the following package references [net6.0]: Top-level Package Requested Resolved
Project 'MyApp.Skia.Gtk' has the following package references [net6.0]: Top-level Package Requested Resolved
No assets file was found for
/home/darko/Documents/GitHub/MyApp/MyApp.Windows/MyApp.Windows.csproj
. Please run restore before running this command.(A) : Auto-referenced package.
Affected platforms
Skia (GTK on Linux/macOS/Windows)
IDE
No response
IDE version
Not using IDE
Relevant plugins
No response
Anything else we need to know?
I'm using Ubuntu 22.04 lts, dotnet --version 6.0.113.
dotnet --list-sdks 2.1.202 [/usr/lib/dotnet/sdk] 5.0.408 [/usr/lib/dotnet/sdk] 6.0.113 [/usr/lib/dotnet/sdk] 7.0.200 [/usr/lib/dotnet/sdk]
dotnet --list-runtimes Microsoft.AspNetCore.App 5.0.17 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.13 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.3 [/usr/lib/dotnet/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.0.9 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.13 [/usr/lib/dotnet/shared/Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.3 [/usr/lib/dotnet/shared/Microsoft.NETCore.App]
Currently, I'm able to compile other projects, no problem.