unoplatform / uno

Open-source platform for building cross-platform native Mobile, Web, Desktop and Embedded apps quickly. Create rich, C#/XAML, single-codebase apps from any IDE. Hot Reload included! 90m+ NuGet Downloads!!
https://platform.uno
Apache License 2.0
9.05k stars 734 forks source link

Create new project broken #18230

Closed mobynet1 closed 2 months ago

mobynet1 commented 2 months ago

Current behavior

I went to create a new Uno project and noticed that the online wizard had been recently updated. In my original project I opted to add Maui support, but the system would not build because of differences in the versions of the Maui nuget packages being used. So, I thought I'd try this again to see if anything had changed and I am seeing a bug being reported that the solution cannot be created because of the Uno.Sdk not being found. Here is a screen shot of the error:

image

I should have reported the Maui issues when I encountered them two months ago so please accept my apologies for not doing so. I remembered at some point, Maui started to wildcard their package versions like so:

    <PackageReference Include="Microsoft.Maui.Controls" Version="8.0.70" />
    <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="8.0.70" />

went to:

    <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
    <PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="$(MauiVersion)" />

I looked for a way to change that at the time and couldn't find it so I decided to forego adding Maui to my project, but now there are Telerik Maui controls that I need to use, hence me trying to create a new solution with Maui support.

This is the configuration I tried to use with the new solution attempt:

image

Expected behavior

Well, find the SDK, obviously! ;-)

How to reproduce it (as minimally and precisely as possible)

No response

Workaround

Haven't tried to find one...

Works on UWP/WinUI

None

Environment

No response

NuGet package version(s)

See the version stuff list above.

Affected platforms

Windows (WinAppSDK)

IDE

No response

IDE version

VS Code 1.93.0; Visual Studio 2022 Version 17.11.2

Relevant plugins

No response

Anything else we need to know?

I really do love Uno!! :-)

mobynet1 commented 2 months ago

I thought I could add the Maui stuff independently so I looked in the Uno documentation to see how to do it. I didn't find specific answers to this, but did see where I could use the command:

dotnet new unoapp -preset blank -maui -o MauiEmbeddingApp

It also failed but I have no idea if it is the same thing I am reporting above:

image

mobynet1 commented 2 months ago

In fact, when I was trying to update the two Maui packages, I got the same two errors I got over a month ago:

Severity    Code    Description Project File    Line    Suppression State
Error       Package restore failed. Rolling back package changes for 'MobyClient.MauiControls'.             
Error   NU1100  Unable to resolve 'Microsoft.Maui.Controls.Compatibility (>= 8.0.90)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com.    MobyClient.MauiControls C:\Development\MobyNet\Dev-Uno\temp\MobyClient\MobyClient.MauiControls\MobyClient.MauiControls.csproj   1   
Error   NU1100  Unable to resolve 'Microsoft.Maui.Controls.Compatibility (>= 8.0.90)' for 'net8.0-windows10.0.19041'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com.  MobyClient.MauiControls C:\Development\MobyNet\Dev-Uno\temp\MobyClient\MobyClient.MauiControls\MobyClient.MauiControls.csproj   1   

Microsoft.Mauji.Controls.Compatibility will not update.

mobynet1 commented 2 months ago

I removed all of the dotnet templates and then reinstalled them. When I try to run the

dotnet new unoapp -preset blank -maui -o SimpleMauiApp

I get the following nasty stuff from dotnet (sorry for dumping a bunch of error messages!):

C:\Users\cimfr\source\repos\SimpleMauiApp>dotnet restore
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp\SimpleMauiApp.csproj : warning NU1503: Skipping restore for project 'C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp\SimpleMauiApp.csproj'. The project file may be invalid
or missing targets required for restore. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
  Determining projects to restore...
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: SimpleMauiApp.MauiControls depends on Microsoft.Maui.Controls (>= 8.0.72) but Microsoft.Maui.Controls 8.0.72 was no
t found. An approximate best match of Microsoft.Maui.Controls 8.0.90 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: Microsoft.Maui.Essentials 8.0.90 depends on Xamarin.AndroidX.Browser (>= 1.5.0.3) but Xamarin.AndroidX.Browser 1.5.
0.3 was not found. An approximate best match of Xamarin.AndroidX.Browser 1.8.0 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: Microsoft.Maui.Essentials 8.0.72 depends on Xamarin.AndroidX.Browser (>= 1.5.0.3) but Xamarin.AndroidX.Browser 1.5.
0.3 was not found. An approximate best match of Xamarin.AndroidX.Browser 1.8.0 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: Microsoft.Maui.Core 8.0.90 depends on Xamarin.AndroidX.SwipeRefreshLayout (>= 1.1.0.14) but Xamarin.AndroidX.SwipeR
efreshLayout 1.1.0.14 was not found. An approximate best match of Xamarin.AndroidX.SwipeRefreshLayout 1.1.0.18 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: Microsoft.Maui.Core 8.0.72 depends on Xamarin.AndroidX.SwipeRefreshLayout (>= 1.1.0.14) but Xamarin.AndroidX.SwipeR
efreshLayout 1.1.0.14 was not found. An approximate best match of Xamarin.AndroidX.SwipeRefreshLayout 1.1.0.18 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: Microsoft.Maui.Core 8.0.90 depends on Xamarin.Google.Android.Material (>= 1.9.0.2) but Xamarin.Google.Android.Mater
ial 1.9.0.2 was not found. An approximate best match of Xamarin.Google.Android.Material 1.10.0.2 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1603: Microsoft.Maui.Core 8.0.72 depends on Xamarin.Google.Android.Material (>= 1.9.0.2) but Xamarin.Google.Android.Mater
ial 1.9.0.2 was not found. An approximate best match of Xamarin.Google.Android.Material 1.10.0.2 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : warning NU1608: Detected package version outside of dependency constraint: Xamarin.AndroidX.Lifecycle.Process 2.6.2.3 requires Xama
rin.AndroidX.Lifecycle.Runtime (>= 2.6.2.3 && < 2.6.3) but version Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.1 was resolved. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.Android.Glide (>= 4.15.1.2)' for 'net8.0-android34.0'. PackageSourceMapping is enabled, th
e following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.AndroidX.Lifecycle.LiveData (>= 2.6.1.3)' for 'net8.0-android34.0'. PackageSourceMapping i
s enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.AndroidX.Navigation.Common (>= 2.6.0.1)' for 'net8.0-android34.0'. PackageSourceMapping is
 enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.AndroidX.Navigation.Fragment (>= 2.6.0.1)' for 'net8.0-android34.0'. PackageSourceMapping
is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.AndroidX.Navigation.Runtime (>= 2.6.0.1)' for 'net8.0-android34.0'. PackageSourceMapping i
s enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.AndroidX.Navigation.UI (>= 2.6.0.1)' for 'net8.0-android34.0'. PackageSourceMapping is ena
bled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.AndroidX.Security.SecurityCrypto (>= 1.1.0.1-alpha06)' for 'net8.0-android34.0'. PackageSo
urceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1100: Unable to resolve 'Xamarin.Google.Crypto.Tink.Android (>= 1.10.0)' for 'net8.0-android34.0'. PackageSourceMapping is
enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, nuget.org, telerik.com. [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1107: Version conflict detected for Xamarin.AndroidX.Lifecycle.Common. Install/reference Xamarin.AndroidX.Lifecycle.Common
2.7.0.1 directly to project SimpleMauiApp.MauiControls to resolve this issue.  [C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1107:  SimpleMauiApp.MauiControls -> Microsoft.Maui.Controls 8.0.90 -> Microsoft.Maui.Controls.Xaml 8.0.90 -> Microsoft.Mau
i.Core 8.0.90 -> Microsoft.Maui.Essentials 8.0.90 -> Xamarin.AndroidX.Browser 1.8.0 -> Xamarin.AndroidX.Core 1.12.0.4 -> Xamarin.AndroidX.Lifecycle.Runtime 2.7.0.1 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.7.0.1 && < 2.7.1)  [C:\Users\
cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.sln]
C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj : error NU1107:  SimpleMauiApp.MauiControls -> Microsoft.Maui.Controls 8.0.90 -> Microsoft.Maui.Controls.Core 8.0.90 -> Microsoft.Mau
i.Core 8.0.90 -> Xamarin.Google.Android.Material 1.10.0.2 -> Xamarin.AndroidX.Fragment 1.6.2.1 -> Xamarin.AndroidX.Lifecycle.LiveData.Core 2.6.2.3 -> Xamarin.AndroidX.Lifecycle.Common (>= 2.6.2.3 && < 2.6.3). [C:\Users\cimfr\source\repo
s\SimpleMauiApp\SimpleMauiApp.sln]
  Failed to restore C:\Users\cimfr\source\repos\SimpleMauiApp\SimpleMauiApp.MauiControls\SimpleMauiApp.MauiControls.csproj (in 360 ms).

I hope this helps. If not, let me know what I need to do to provide more detail. Regards, Steve

jeromelaban commented 2 months ago

Thanks for the report. This looks like a local nuget configuration issue, as Microsoft.Maui.Controls 8.0.72 exists on nuget.org: https://www.nuget.org/packages/Microsoft.Maui.Controls/8.0.72. You may want to take a look at %appdata%\NuGet\NuGet.Config and see if there's any unusual configuration that could cause this issue.

mobynet1 commented 2 months ago

@jeromelaban Thanks for your response.

The NuGet.Config file looks ok:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="telerik.com" value="https://nuget.telerik.com/v3/index.json" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </packageSources>
  <packageSourceCredentials>
    <telerik.com>
        <add key="Username" value="steve@mobynet.io" />
        <add key="Password" value="*****" />
      </telerik.com>
  </packageSourceCredentials>
  <packageSourceMapping>
    <packageSource key="telerik.com">
        <package pattern="Telerik.UI.for.Maui" />
      </packageSource>
    <packageSource key="NuGet official package source">
      <package pattern="*" />
    </packageSource>
    <packageSource key="unoplatformdev">
      <package pattern="*" />
    </packageSource>
    <packageSource key="Microsoft Visual Studio Offline Packages">
      <package pattern="*" />
    </packageSource>
  </packageSourceMapping>
  <packageRestore>
    <add key="enabled" value="True" />
  </packageRestore>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <packageManagement>
    <add key="format" value="0" />
    <add key="disabled" value="False" />
  </packageManagement>
  <disabledPackageSources>
    <add key="Microsoft Visual Studio Offline Packages" value="true" />
  </disabledPackageSources>
</configuration>

All this is is this:

image

All of this looks fine. What else can I look for?

jeromelaban commented 2 months ago

It looks like there are source mappings that may be conflicting with the restore process. Can you try emptying packageSourceMapping and try restoring the project again ?

mobynet1 commented 2 months ago

Well, I spun up a new VM and created a new project without issue. That is good news for you!! So, now the question is, how can I repair my main dev env? Is there something I need to download to get the missing Uno.Sdk to repair my environment?

jeromelaban commented 2 months ago

Thanks. Could you try removing/renaming the nuget.org file altogether and see if it helps?

Fabi commented 2 months ago

Is your global.json broken or not there? That's basically the file that makes Uno.Sdk available to dotnet

mobynet1 commented 2 months ago

Well, I don't have time to eff around on this any longer. You guys have done a great job so there isn't anything more I need from you. Just beware of using any of the suggestions of these AI coding pair applications without caution. Something was amiss two weeks ago and CodiumUI told me to do something and it truly did a royal job on mucking up my dev environment. I dusted off a laptop I never use and set it up with a new dev environment.

You guys know the drill. The closer you get to a deliverable milestone, the harder the forces of evil gang up on you and make life as miserable as possible making getting to "Done Done" is futile. Oh well, life goes on.

Again, I do love Uno. Compared to my experience with Maui, you guys do it right!