Home > OS >  .Net MAUI Windows Publishing
.Net MAUI Windows Publishing

Time:02-20

I am trying to create a installable artifact of my MAUI Blazor application for windows. From all of my research I am to run the below command using MSBuild.

Github issue

"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}"

However, When I run the command I get a long list of errors. (I can debug the app via Visual Studio with no issue)

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)

From the looks of it the main issue is package downgrades and compatibility net6.0-maccatalyst15.2. Dose anyone know how to resolve this?

UPDATE
I have created a new MAUI Blazor app and moved all of my files over. This solved some of the issues (my project was too old, the template had received several updates). Now I am getting several of the below error.

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

The above mentioned is a common library that is .net 6, and it only contains simple DTO's. When I build the app for iOS, Android, and MacOS everything is fine. However, when I try to make a windows installable artifact I get that issue.

UPDATE 2
I needed to change my class library to a MAUI library.

CodePudding user response:

This is a two part answer. First my MAUI template was old, so I created a new project and copied over the files. Second, I needed to use a MAUI library as my common library.

  • Related