win-x64
运行时ID(RID)的Windows。
i可以使用
dotnet build
很好地构建应用程序。 Windows应用程序成功构建到<Solution>\bin\Debug\net9.0-windows10.0.19041.0\win10-x64\<Solution>.dll
.。 ,但是,运行时,我会收到以下错误:
dotnet publish -r win-x64 --output "<publishdir>"
我尝试了什么I尝试使用VS Code
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.org [ Nearest version: 9.0.0-preview.7.24405.7 ]
- Found 0 version(s) in C:\Program Files\dotnet\library-packs
命令,CLI命令安装Nuget软件包,并手动添加软件包。 这些解决方案中的任何解决方案都没有效用,因为该软件包是在版本
Microsoft.NETCore.App.Runtime.Mono.win-x64
中删除的;我正在使用.NET SDK AT版本:
NuGet: Add NuGet Package...
我确保了我所引用的nuget软件包不要使用这种依赖性,我认为它们没有:
9.0.0- preview.7.24405.7
:
9.0.103
从我的研究和理解(不是最好的;我是中间.NET用户),Nuget Package Manager将永远无法解决此问题,因为它找不到满足PS C:\<Solution Location>> dotnet --list-sdks
9.0.103 [C:\Program Files\dotnet\sdk]
条件的版本。
我怎么能解决这个问题?我可以忽略一个简单的解决方案,但是我似乎找不到有关此类错误的任何信息。 如果我可以添加到这个问题上的任何信息,请告诉我。我仍在学习.NET框架,所以我不知道所有最好的调试技术。
答案:
请请参考有关Windows的官方文件。
发布一个包装的.Net Maui应用程序,用于使用CLI,例如:
.csproj
发布一个带有CLI的Windows的未包装的.NET MAUI应用,例如:
<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>