-1

我正在尝试为 Windows 的 MAUI Blazor 应用程序创建可安装的工件。根据我的所有研究,我将使用 MSBuild 运行以下命令。

Github问题

"C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\msbuild" /restore /t:Publish /p:TargetFramework=net6.0-windows10.0.19041 /p:configuration=release /p:GenerateAppxPackageOnBuild=true /p:AppxPackageSigningEnabled=true /p:PackageCertificateThumbprint="{myThumbPrint}" /p:PackageCertificatePassword="{myPassword}"

但是,当我运行命令时,我会得到一长串错误。(我可以通过 Visual Studio 毫无问题地调试应用程序)

Build FAILED.

"PathToMyProject\myProject.csproj" (Restore target)
 (1) ->
(Restore target) ->
  PathToMyProject\myProject.csproj : error NU1605:
Detected package downgrade: Microsoft.Graphics.Win2D from 1.0.0.30 to 1.0.0.29-preview3. Reference the package directly
 from the project to select a different version.
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.Maui.Dependencies 6.0.200-preview.13.2865 -> Microsoft.Graphics.Win2D (>= 1.0.0.30
)
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.Graphics.Win2D (>= 1.0.0.29-preview3)
  PathToMyProject\myProject.csproj : error NU1605:
Detected package downgrade: Microsoft.WindowsAppSDK from 1.0.0 to 1.0.0-preview3. Reference the package directly from t
he project to select a different version.
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.Maui.Dependencies 6.0.200-preview.13.2865 -> Microsoft.WindowsAppSDK (>= 1.0.0)
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.WindowsAppSDK (>= 1.0.0-preview3)
  PathToMyProject\myProject.csproj : error NU1605:
Detected package downgrade: Microsoft.Graphics.Win2D from 1.0.0.30 to 1.0.0.29-preview3. Reference the package directly
 from the project to select a different version.
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.AspNetCore.Components.WebView.Maui 6.0.200-preview.13.2865 -> Microsoft.Graphics.W
in2D (>= 1.0.0.30)
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.Graphics.Win2D (>= 1.0.0.29-preview3)
  PathToMyProject\myProject.csproj : error NU1605:
Detected package downgrade: Microsoft.WindowsAppSDK from 1.0.0 to 1.0.0-preview3. Reference the package directly from t
he project to select a different version.
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.AspNetCore.Components.WebView.Maui 6.0.200-preview.13.2865 -> Microsoft.WindowsApp
SDK (>= 1.0.0)
PathToMyProject\myProject.csproj : error NU1605:  S
DS2.JobScheduler.Client -> Microsoft.WindowsAppSDK (>= 1.0.0-preview3)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-android31.0 (.NETCoreApp,Version=v6.0). Project SDS2.Job
Scheduler.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-ios15.2 (.NETCoreApp,Version=v6.0). Project SDS2.JobSche
duler.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-maccatalyst15.2 (.NETCoreApp,Version=v6.0). Project SDS2
.JobScheduler.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-android31.0 (.NETCoreApp,Version=v6.0) / win-x64. Projec
t MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-android31.0 (.NETCoreApp,Version=v6.0) / win10-arm64. Pr
oject MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-android31.0 (.NETCoreApp,Version=v6.0) / win10-x64. Proj
ect MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-android31.0 (.NETCoreApp,Version=v6.0) / win10-x86. Proj
ect MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-ios15.2 (.NETCoreApp,Version=v6.0) / win-x64. Project SD
S2.JobScheduler.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-ios15.2 (.NETCoreApp,Version=v6.0) / win10-arm64. Projec
t MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-ios15.2 (.NETCoreApp,Version=v6.0) / win10-x64. Project
MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-ios15.2 (.NETCoreApp,Version=v6.0) / win10-x86. Project
MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-maccatalyst15.2 (.NETCoreApp,Version=v6.0) / win-x64. Pr
oject MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-maccatalyst15.2 (.NETCoreApp,Version=v6.0) / win10-arm64
. Project MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-maccatalyst15.2 (.NETCoreApp,Version=v6.0) / win10-x64.
Project MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)
  PathToMyProject\myProject.csproj : error NU1201:
Project MyProject.Common is not compatible with net6.0-maccatalyst15.2 (.NETCoreApp,Version=v6.0) / win10-x86.
Project MyProject.Common supports: net6.0-windows10.0.19041 (.NETCoreApp,Version=v6.0)

从外观上看,主要问题是软件包降级和兼容性 net6.0-maccatalyst15.2。有人知道如何解决这个问题吗?

更新
我创建了一个新的 MAUI Blazor 应用程序并将我的所有文件都移了过来。这解决了一些问题(我的项目太旧了,模板已经收到了几次更新)。现在我收到以下几个错误。

Project MyProject.Common is not compatible with net6.0-maccatalyst15.2

上面提到的是.net 6的通用库,它只包含简单的DTO。当我为 iOS、Android 和 MacOS 构建应用程序时,一切都很好。但是,当我尝试制作 Windows 可安装工件时,我遇到了这个问题。

更新 2
我需要将我的类库更改为 MAUI 库。

4

1 回答 1

0

这是一个两部分的答案。首先我的 MAUI 模板很旧,所以我创建了一个新项目并复制了文件。其次,我需要使用一个 MAUI 库作为我的公共库。

于 2022-02-19T19:40:21.557 回答