Goal
I'm attempting to publish my built .NET MAUI application from VS Code using the integrated terminal and .NET CLI. The target OS is Windows using the win-x64
Runtime ID (RID).
Problem
I can build the application using dotnet build
just fine. The Windows application builds successfully to <Solution>\bin\Debug\net9.0-windows10.0.19041.0\win10-x64\<Solution>.dll
.
However, when running dotnet publish -r win-x64 --output "<publishdir>"
, I receive the following error:
C:\<Solution Location>\<Solution>.csproj : error NU1102:
Unable to find package Microsoft.NETCore.App.Runtime.Mono.win-x64 with version (= 9.0.2)
- Found 104 version(s) in nuget [ Nearest version: 9.0.0-preview.7.24405.7 ]
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
What I've Tried
I attempted to install the Microsoft.NETCore.App.Runtime.Mono.win-x64
NuGet package using the VS Code NuGet: Add NuGet Package...
command, the CLI command, and manually adding the package.
None of these solutions worked because the package is deprecated at version 9.0.0- preview.7.24405.7
; I am using the .NET SDK at version 9.0.103
:
PS C:\<Solution Location>> dotnet --list-sdks
9.0.103 [C:\Program Files\dotnet\sdk]
I've ensured that the NuGet Packages I'm referencing don't use this dependency, and I don't think they do:
.csproj
:
<ItemGroup>
// compatible w/.NET 9 according to website
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
// default MAUI Package
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.40" />
// default MAUI Package
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.2" />
// does not have dependencies, according to Repository
<PackageReference Include="QRCoder" Version="1.6.0" />
// .NET system Package
<PackageReference Include="System.Drawing.Common" Version="9.0.2" />
</ItemGroup>
From my research and understanding (not the best; I am an intermediate .NET user), the NuGet Package Manager will never be able to resolve this because it cannot find a version that satisfies the = 9.0.2
condition.
How can I resolve this? I could be overlooking a simple solution, but I can't seem to find any information on an error like this.
If there's any information I can add to this question, please tell me. I'm still learning the .NET framework so I don't know all the best debugging techniques.
Goal
I'm attempting to publish my built .NET MAUI application from VS Code using the integrated terminal and .NET CLI. The target OS is Windows using the win-x64
Runtime ID (RID).
Problem
I can build the application using dotnet build
just fine. The Windows application builds successfully to <Solution>\bin\Debug\net9.0-windows10.0.19041.0\win10-x64\<Solution>.dll
.
However, when running dotnet publish -r win-x64 --output "<publishdir>"
, I receive the following error:
C:\<Solution Location>\<Solution>.csproj : error NU1102:
Unable to find package Microsoft.NETCore.App.Runtime.Mono.win-x64 with version (= 9.0.2)
- Found 104 version(s) in nuget. [ Nearest version: 9.0.0-preview.7.24405.7 ]
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
What I've Tried
I attempted to install the Microsoft.NETCore.App.Runtime.Mono.win-x64
NuGet package using the VS Code NuGet: Add NuGet Package...
command, the CLI command, and manually adding the package.
None of these solutions worked because the package is deprecated at version 9.0.0- preview.7.24405.7
; I am using the .NET SDK at version 9.0.103
:
PS C:\<Solution Location>> dotnet --list-sdks
9.0.103 [C:\Program Files\dotnet\sdk]
I've ensured that the NuGet Packages I'm referencing don't use this dependency, and I don't think they do:
.csproj
:
<ItemGroup>
// compatible w/.NET 9 according to website
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.4.0" />
// default MAUI Package
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.40" />
// default MAUI Package
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.2" />
// does not have dependencies, according to Repository
<PackageReference Include="QRCoder" Version="1.6.0" />
// .NET system Package
<PackageReference Include="System.Drawing.Common" Version="9.0.2" />
</ItemGroup>
From my research and understanding (not the best; I am an intermediate .NET user), the NuGet Package Manager will never be able to resolve this because it cannot find a version that satisfies the = 9.0.2
condition.
How can I resolve this? I could be overlooking a simple solution, but I can't seem to find any information on an error like this.
If there's any information I can add to this question, please tell me. I'm still learning the .NET framework so I don't know all the best debugging techniques.
Share Improve this question edited Feb 14 at 20:31 Mason Ritchason asked Feb 14 at 18:37 Mason RitchasonMason Ritchason 701 silver badge9 bronze badges 5 |1 Answer
Reset to default 1As an answer:
Please refer to the official document about Publish a .NET MAUI app for Windows.
- Publish a packaged .NET MAUI app for Windows with the CLI, such as:
dotnet publish -f net9.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64
- Publish an unpackaged .NET MAUI app for Windows with the CLI, such as:
dotnet publish -f net9.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None -p:WindowsAppSDKSelfContained=true
<MauiVersion>9.0.40</MauiVersion>
? – Stephen Quan Commented Feb 15 at 4:13dotnet publish -r win-x64 --output "<publishdir>
, I got the RuntimeIdentifier error. But I can usedotnet publish -f net9.0-windows10.0.19041.0 -c Release -p:RuntimeIdentifierOverride=win10-x64 -p:WindowsPackageType=None
to publish the app. – Liyun Zhang - MSFT Commented Feb 17 at 8:18dotnet publish
command documentation to understand the difference between these two command option sets. What is the best way to distribute this unpackaged Windows application (I know this is a VERY open ended question; if you have some general resources to lead me in the right direction, that's what I mean)? Thank you! – Mason Ritchason Commented Feb 18 at 14:19