-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
I was having trouble getting the Doc FX framework to work with my Win.UI project.
I have the following csproj file for a Win.UI project out of the MAUI template project. I use RuntimeIdentifiers win-x86;win-x64;win-arm64. (I also tried with win10-x86;win10-x64;win10-arm64):
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows10.0.19041.0</TargetFramework>
<TargetPlatformMinVersion>10.0.17763.0</TargetPlatformMinVersion>
<RootNamespace>AppiumMauiApp.WinUI</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x86;x64;ARM64</Platforms>
<Platform Condition="'$(Platform)' == ''">x64</Platform>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<PublishProfile>Properties\PublishProfiles\win-msix.pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseMaui>true</UseMaui>
<!-- We do not want XAML files to be processed as .NET MAUI XAML, but rather WinUI XAML. -->
<EnableDefaultMauiItems>false</EnableDefaultMauiItems>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>False</AppxSymbolPackageEnabled>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundle>Always</AppxBundle>
<AppInstallerUri>C:\Users\user1\source\repos\AppiumMauiApp\PublishedOutputs/AllControlsMauiApp.WinUI</AppInstallerUri>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="9.0.82" />
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="9.0.82" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="9.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AllControlsMauiApp\AllControlsMauiApp.csproj" />
</ItemGroup>
<ItemGroup>
<!-- Make sure all image assets to be in the root of the package to match the other platforms -->
<Content Update="Assets\Images\*" TargetPath="%(Filename)%(Extension)" />
</ItemGroup>
<ItemGroup>
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>
<!--
Defining the "Msix" ProjectCapability here allows the Single-project MSIX Packaging
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<!--
Defining the "HasPackageAndPublishMenuAddedByProject" property here allows the Solution
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
<PropertyGroup>
<IsVisualStudio Condition="'$(VisualStudioVersion)' != ''">true</IsVisualStudio>
</PropertyGroup>
<PropertyGroup>
<AppPackageName>$(AssemblyName)_$(Version)_$(Platform)_$(Configuration).msix</AppPackageName>
<WindowsPackageType>MSIX</WindowsPackageType>
<AppxBundlePlatforms>x86|x64</AppxBundlePlatforms>
<PackageCertificateThumbprint>A56F1F06B9B95A5A44A4A49D74A4A85CC75D61D9</PackageCertificateThumbprint>
</PropertyGroup>
"dotnet build -p:RuntimeIdentifier=win-x64 -p:Platform=x64" etc work fine. But, when running "dotnet clean", "dotnet build", "dotnet restore" without explicitly passing the RuntimeIdentifier , I get the following error:
AllControlsMauiApp.WinUI fehlerhaft mit 1 Fehler(n) (0,0s)
C:\Program Files\dotnet\sdk\9.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(107,5): error NETSDK1083: Der angegebene RuntimeIdentifier "win-AnyCPU" wird nicht erkannt. Weitere Informationen finden Sie unter https://aka.ms/netsdk1083.
Erstellen von fehlerhaft mit 1 Fehler(n) in 0,4s
I ran "dotnet clean /b" and examined the log file with MS Build Structured Log Viewer. I searched "RuntimeIdentifier win-AnyCPU" and got this:
12 results. Search took: 1 ms
Evaluation
AllControlsMauiApp.WinUI.csproj
RuntimeIdentifier = win-AnyCPU
Neuzuweisung der Eigenschaft: $(IntermediateOutputPath)="obj\Debug\net9.0-windows10.0.19041.0\win-AnyCPU" (vorheriger Wert: "obj\Debug\net9.0-windows10.0.19041.0") unter C:\Program Files\dotnet\sdk\9.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets (344,5)
Neuzuweisung der Eigenschaft: $(OutputPath)="bin\Debug\net9.0-windows10.0.19041.0\win-AnyCPU" (vorheriger Wert: "bin\Debug\net9.0-windows10.0.19041.0") unter C:\Program Files\dotnet\sdk\9.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets (345,5)
$(MSBuildThisFileDirectory)WorkloadManifest.Wasi.targets
$(MSBuildThisFileDirectory)WasmFeatures.props
AllControlsMauiApp.WinUI.csproj
_CheckForUnsupportedAppHostUsage
Die NETSdkError-Aufgabe wurde übersprungen, da die Bedingung "false" war . ('$(SelfContained)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(AllowSelfContainedWithoutRuntimeIdentifier)' != 'true') wurde als ('false' == 'true' and 'win-AnyCPU' == '' and '' != 'true') ausgewertet.
Die NETSdkError-Aufgabe wurde übersprungen, da die Bedingung "false" war . ('$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true') wurde als ('' == 'true' and 'win-AnyCPU' == '' and '' == 'true') ausgewertet.
Die NETSdkError-Aufgabe wurde übersprungen, da die Bedingung "false" war . ('$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true') wurde als ('' == 'true' and 'win-AnyCPU' == '' and '' == 'true') ausgewertet.
Die NETSdkError-Aufgabe wurde übersprungen, da die Bedingung "false" war . ('$(PublishAot)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true' and '$(AllowPublishAotWithoutRuntimeIdentifier)' != 'true') wurde als ('' == 'true' and 'win-AnyCPU' == '' and '' == 'true' and '' != 'true') ausgewertet.
Die NETSdkWarning-Aufgabe wurde übersprungen, da die Bedingung "false" war . ('$(RuntimeIdentifier)' != '' and '$(_TargetFrameworkVersionWithoutV)' != '' and $([MSBuild]::VersionLessThan($(_TargetFrameworkVersionWithoutV), '8.0')) and '$(_SelfContainedWasSpecified)' != 'true') wurde als ('win-AnyCPU' != '' and '9.0' != '' and False and '' != 'true') ausgewertet.
ProcessFrameworkReferences
ProcessFrameworkReferences
RuntimeIdentifier = win-AnyCPU
C:\Program Files\dotnet\sdk\9.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(107,5): error NETSDK1083: Der angegebene RuntimeIdentifier "win-AnyCPU" wird nicht erkannt. Weitere Informationen finden Sie unter https://aka.ms/netsdk1083. [C:\Users\user1\source\repos\AppiumMauiApp\AllControlsMauiApp\AllControlsMauiApp.WinUI\AllControlsMauiApp.WinUI.csproj]
I showed the results to Google AI which advised me to contact you:
"Your analysis of the .binlog output is absolutely correct. What you're seeing tells us definitively:
RuntimeIdentifier = win-AnyCPU is being set: This property is indeed getting this invalid value during the project evaluation.
The Culprit: The line C:\Program Files\dotnet\sdk\9.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.RuntimeIdentifierInference.targets (344,5) points directly to the source.
This is a core .NET SDK targets file, specifically designed for Runtime Identifier inference.
Line 344 (and 345 for OutputPath) within this file is where the SDK is attempting to figure out the RuntimeIdentifier for your build when it's not explicitly provided.
The fact that it's inferring win-AnyCPU for a WinUI/MAUI project on Windows, even when your csproj lists valid win-x86, win-x64, win-arm64 RIDs and you've tried to set a default Platform, indicates a bug in the .NET SDK 9.0.302's inference logic. It's incorrectly combining the "Windows" platform with a general "AnyCPU" concept, which is not a valid Runtime Identifier."
"Report this bug to Microsoft: This behavior in dotnet SDK 9.0.302 is unexpected and should be reported. You can open an issue on the dotnet/sdk GitHub repository, providing the details you've uncovered (especially the binlog output showing Microsoft.NET.RuntimeIdentifierInference.targets (344,5) setting win-AnyCPU)."
It seems your RuntimeIdentifierInference is overwriting RuntimeIdentifiers even when they are explicilty set.
I hope this helps.
Kevin
dotnet --info:
.NET SDK:
Version: 9.0.302
Commit: bb2550b
Workload version: 9.0.300-manifests.183aaee6
MSBuild version: 17.14.13+65391c53b
Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19045
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\9.0.302\
Installierte .NET-Workloads:
[android]
Installationsquelle: SDK 9.0.300, VS 17.14.36301.6
Manifestversion: 35.0.78/9.0.100
Manifestpfad: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.78\WorkloadManifest.json
Installationstyp: Msi
[aspire]
Installationsquelle: SDK 9.0.300, VS 17.14.36301.6
Manifestversion: 8.2.2/8.0.100
Manifestpfad: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.2\WorkloadManifest.json
Installationstyp: Msi
[ios]
Installationsquelle: SDK 9.0.300, VS 17.14.36301.6
Manifestversion: 18.5.9207/9.0.100
Manifestpfad: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.5.9207\WorkloadManifest.json
Installationstyp: Msi
[maccatalyst]
Installationsquelle: SDK 9.0.300, VS 17.14.36301.6
Manifestversion: 18.5.9207/9.0.100
Manifestpfad: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.5.9207\WorkloadManifest.json
Installationstyp: Msi
[maui-windows]
Installationsquelle: SDK 9.0.300, VS 17.14.36301.6
Manifestversion: 9.0.51/9.0.100
Manifestpfad: C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.51\WorkloadManifest.json
Installationstyp: Msi
Konfiguriert für die Verwendung loose manifests beim Installieren neuer Manifeste.
Host:
Version: 9.0.7
Architecture: x64
Commit: 3c298d9f00
.NET SDKs installed:
5.0.416 [C:\Program Files\dotnet\sdk]
6.0.428 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
7.0.120 [C:\Program Files\dotnet\sdk]
7.0.410 [C:\Program Files\dotnet\sdk]
8.0.100-preview.7.23376.3 [C:\Program Files\dotnet\sdk]
9.0.100-rc.2.24474.11 [C:\Program Files\dotnet\sdk]
9.0.302 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.0-preview.7.23375.9 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.0-preview.7.23375.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.12 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.0-preview.7.23376.1 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.18 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.7 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
global.json file:
Not found
Learn more:
https://aka.ms/dotnet/info
Download .NET:
https://aka.ms/dotnet/download
Describe the bug
A clear and concise description of what the bug is.
To Reproduce
Exceptions (if any)
Further technical details
- Include the output of
dotnet --info
- The IDE (VS / VS Code/ VS4Mac) you're running on, and its version