Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue while building project with CLI: Incorrect use of net472 XAML compiler #8871

Open
LeonSpors opened this issue Sep 15, 2023 · 3 comments
Labels
bug Something isn't working team-Markup Issue for the Markup team

Comments

@LeonSpors
Copy link

Describe the bug

I'm encountering an issue while trying to build my project using the command line instead of Visual Studio. I receive the following error:

 C:\Users\leon.spors\.nuget\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\Microsoft.UI.Xaml.Markup.Compiler.interop.targets(760,9): error MSB3073: The command ""C:\Users\leon.spors\.nuget\packages\microsoft.windowsappsdk\1.3.230724000\buildTransitive\..\tools\net5.0\..\net472\XamlCompiler.exe" "obj\x64\Release\net7.0-windows10.0.19041.0\win-x64\\input.json" "obj\x64\Release\net7.0-windows10.0.19041.0\win-x64\\output.json"" exited with code 1.

It is weird that it uses the net472 xaml compiler. Is it a fallback? Did I miss something?

csproj

<PropertyGroup>
	<OutputType>WinExe</OutputType>
	<TargetFramework>net7.0-windows10.0.19041.0</TargetFramework>
	<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
	<Platforms>x64</Platforms>
	<RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>
	<LangVersion>latest</LangVersion>
	<Nullable>enable</Nullable>
	<ApplicationIcon>Assets\Kevox.Windows.ico</ApplicationIcon>
	<ApplicationManifest>app.manifest</ApplicationManifest>
	<UseWinUI>true</UseWinUI>
	<EnableMsixTooling>true</EnableMsixTooling>
	<WindowsPackageType>None</WindowsPackageType>
	<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
	<SelfContained>true</SelfContained>
	<EnableWindowsTargeting>true</EnableWindowsTargeting>

	<!--Workaround-->
	<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>

	<FileVersion>0.4.12</FileVersion>
</PropertyGroup>

Steps to reproduce the bug

Clear your project obj/bin folders.
Use the following command

dotnet publish <YourProjectName.csproj> -c Release -r win-x64 -p:Platform=x64 --self-contained true -o <Your output folder>

Expected behavior

It should publish like Visual Studio does but it seems there is a difference.

Screenshots

No response

NuGet package version

WinUI 3 - Windows App SDK 1.4.0: 1.4.230822000

Windows version

Windows 11 (22H2): Build 22621, Windows 11 (21H2): Build 22000, Windows 10 (21H2): Build 19044, Windows 10 (21H1): Build 19043, Windows 10 (20H2): Build 19042, Windows 10 (1809): Build 17763

Additional context

No response

@LeonSpors LeonSpors added the bug Something isn't working label Sep 15, 2023
@LeonSpors LeonSpors changed the title Unable to publish with cli Issue while building project with CLI: Incorrect use of net472 XAML compiler Sep 15, 2023
@bpulliam bpulliam added the team-Markup Issue for the Markup team label Oct 18, 2023
@madhavcanarymail
Copy link

+1

@Naveen61097
Copy link

Naveen61097 commented Apr 8, 2024

I am facing the same issue. My project packs successfully from the Visual Studio UI (pack option). It also works perfectly if I use the command "dotnet pack {csproj}". But the problem is that restoring the packages in my specific folder throws the error.

respective command - "dotnet pack {csproj} --packages packages"

@azchohfi
Copy link
Contributor

Hitting the same issue. xamlcompiler.exe needs better logging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working team-Markup Issue for the Markup team
Projects
None yet
Development

No branches or pull requests

5 participants