我正在尝试使用 Uno Platform 设置桌面应用程序。我已经尝试了一个星期了,但没有成功。在下载平台期间,我的互联网连接不是很好,所以我怀疑是不是包没有正确下载,但我找不到解决问题的方法。我尝试使用 Uno Platform 模板向导来构建它。命令是:
dotnet new unoapp -o unot2 -preset "recommended" -id "com.companyname.unot2" -pub "O=unot2" -platforms "maccatalyst" -platforms "windows" -theme-service -vscode -pwa False -theme "material" -presentation "mvux" -config -di -log "default" -nav "regions" -http -loc -server -tests "unit" -tests "ui" -toolkit -dsp
我得到了那份巨大的失败清单:
The template "Uno Platform App" was created successfully.
Processing post-creation actions...
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln:
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj : warning NU1503: Skipping restore for project 'C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj'. The project file may be invalid or missing targets required for restore. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj : warning NU1503: Skipping restore for project 'C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj'. The project file may be invalid or missing targets required for restore. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj : warning NU1503: Skipping restore for project 'C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj'. The project file may be invalid or missing targets required for restore. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
Determining projects to restore...
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'FluentAssertions (>= 6.12.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'Microsoft.NET.Test.Sdk (>= 17.8.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'NUnit (>= 4.0.1)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'NUnit3TestAdapter (>= 4.5.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'coverlet.collector (>= 6.0.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Server\unot2.Server.csproj : error NU1100: Unable to resolve 'Swashbuckle.AspNetCore (>= 6.5.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'FluentAssertions (>= 6.12.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Microsoft.NET.Test.Sdk (>= 17.8.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Newtonsoft.Json (>= 13.0.3)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'NUnit (>= 4.0.1)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'NUnit3TestAdapter (>= 4.5.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Uno.UITest.Helpers (>= 1.1.0-dev.70)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Xamarin.UITest (>= 4.3.3)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source. [C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.sln]
Restored C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.DataContracts\unot2.DataContracts.csproj (in 332 ms).
Failed to restore C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj (in 329 ms).
Failed to restore C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj (in 333 ms).
Failed to restore C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Server\unot2.Server.csproj (in 387 ms).
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj:
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj : error : Could not resolve SDK "Uno.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj : error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj : error : Unable to resolve 'Uno.Sdk (= 5.1.50)' for '.NETStandard,Version=v0.0'. PackageSourceMapping is enabled, the following source(s) were not considered: contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj : error : MSB4276: The default SDK resolver failed to resolve SDK "Uno.Sdk" because directory "C:\Program Files\dotnet\sdk\8.0.200\Sdks\Uno.Sdk\Sdk" did not exist.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2\unot2.csproj : error MSB4236: The SDK 'Uno.Sdk' specified could not be found.
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Shared\unot2.Shared.csproj:
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Shared\unot2.Shared.csproj : error : Could not resolve SDK "Microsoft.Build.NoTargets". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Shared\unot2.Shared.csproj : error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Shared\unot2.Shared.csproj : error : Unable to resolve 'Microsoft.Build.NoTargets (= 3.7.56)' for '.NETStandard,Version=v0.0'. PackageSourceMapping is enabled, the following source(s) were not considered: contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Shared\unot2.Shared.csproj : error : MSB4276: The default SDK resolver failed to resolve SDK "Microsoft.Build.NoTargets" because directory "C:\Program Files\dotnet\sdk\8.0.200\Sdks\Microsoft.Build.NoTargets\Sdk" did not exist.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Shared\unot2.Shared.csproj : error MSB4236: The SDK 'Microsoft.Build.NoTargets' specified could not be found.
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Server\unot2.Server.csproj:
Determining projects to restore...
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Server\unot2.Server.csproj : error NU1100: Unable to resolve 'Swashbuckle.AspNetCore (>= 6.5.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
Failed to restore C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Server\unot2.Server.csproj (in 67 ms).
1 of 2 projects are up-to-date for restore.
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.DataContracts\unot2.DataContracts.csproj:
Determining projects to restore...
All projects are up-to-date for restore.
Restore succeeded.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj:
Determining projects to restore...
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'FluentAssertions (>= 6.12.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'Microsoft.NET.Test.Sdk (>= 17.8.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'NUnit (>= 4.0.1)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'NUnit3TestAdapter (>= 4.5.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj : error NU1100: Unable to resolve 'coverlet.collector (>= 6.0.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
Failed to restore C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Tests\unot2.Tests.csproj (in 18 ms).
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj:
Determining projects to restore...
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'FluentAssertions (>= 6.12.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Microsoft.NET.Test.Sdk (>= 17.8.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Newtonsoft.Json (>= 13.0.3)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'NUnit (>= 4.0.1)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'NUnit3TestAdapter (>= 4.5.0)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Uno.UITest.Helpers (>= 1.1.0-dev.70)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj : error NU1100: Unable to resolve 'Xamarin.UITest (>= 4.3.3)' for 'net8.0'. PackageSourceMapping is enabled, the following source(s) were not considered: C:\Program Files\dotnet\library-packs, contoso.com, NuGet official package source.
Failed to restore C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.UITests\unot2.UITests.csproj (in 13 ms).
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\Directory.Packages.props:
Restore succeeded.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj:
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj : error : Could not resolve SDK "Uno.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj : error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj : error : Unable to resolve 'Uno.Sdk (= 5.1.50)' for '.NETStandard,Version=v0.0'. PackageSourceMapping is enabled, the following source(s) were not considered: contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj : error : MSB4276: The default SDK resolver failed to resolve SDK "Uno.Sdk" because directory "C:\Program Files\dotnet\sdk\8.0.200\Sdks\Uno.Sdk\Sdk" did not exist.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Mobile\unot2.Mobile.csproj : error MSB4236: The SDK 'Uno.Sdk' specified could not be found.
Restore failed.
Restoring C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj:
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj : error : Could not resolve SDK "Uno.Sdk". Exactly one of the probing messages below indicates why we could not resolve the SDK. Investigate and resolve that message to correctly specify the SDK.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj : error : SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" returned null.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj : error : Unable to resolve 'Uno.Sdk (= 5.1.50)' for '.NETStandard,Version=v0.0'. PackageSourceMapping is enabled, the following source(s) were not considered: contoso.com, NuGet official package source.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj : error : MSB4276: The default SDK resolver failed to resolve SDK "Uno.Sdk" because directory "C:\Program Files\dotnet\sdk\8.0.200\Sdks\Uno.Sdk\Sdk" did not exist.
C:\Users\Admin\Desktop\uno platform\t4\unot2\unot2.Windows\unot2.Windows.csproj : error MSB4236: The SDK 'Uno.Sdk' specified could not be found.
Restore failed.
Post action failed.
Manual instructions: Run 'dotnet restore'
此外,我注意到:
Skipping NuGet package signature verification.
我已将 uno 环境升级到 .NET 8 并尝试检查 .NET 8 SDK 或 FluentAssertions NuGet 包是否存在问题,但无法重现您的问题。因此我猜测,这可能与您本地的安装有关。
尝试将其更新到最新版本,然后使用以下命令检查安装情况:
dotnet tool update -g uno.check
uno-check
不应有警告或错误。当 .NET 8 发布时,FluentAssertions 似乎遇到了问题,但您的帖子似乎较新(https://github.com/fluentassertions/ Fluentassertions/issues/2465)。如果更新/检查不能解决问题,也许您可以使用 uno-check 信息检查并更新您的帖子。
Uno 文档提到了这个问题。 在撰写本文时,建议如下:
%AppData%\NuGet\NuGet.Config
另外,让我补充一下,以上内容都不适合我......但是从我的机器的 Nuget global-packages 文件夹中删除
Uno.Sdk
文件夹确实有效! 您可以在此处找到该文件夹:
删除开发环境的 Nuget 包
Uno.Sdk
文件夹中的 global-packages
文件夹:
可以使用 NUGET_PACKAGES
环境变量、
globalPackagesFolder
或
repositoryPath
配置设置(分别使用 PackageReference 和
packages.config
时)或
RestorePackagesPath
MSBuild 属性(仅限 MSBuild)覆盖此文件夹。环境变量优先于配置设置。