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

Building WinUI app under .NET 6 results in build error #7452

Closed
Tracked by #7250
dellis1972 opened this issue Mar 9, 2022 · 6 comments · Fixed by #7720
Closed
Tracked by #7250

Building WinUI app under .NET 6 results in build error #7452

dellis1972 opened this issue Mar 9, 2022 · 6 comments · Fixed by #7720
Assignees
Labels
Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. .NET Core triaged
Milestone

Comments

@dellis1972
Copy link

Issue Description

Building a WinUI app under .NET 6 results in the following error

error MSB4062: The "Microsoft.Build.Tasks.GetInstalledSDKLocations" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Steps to Reproduce

Its difficult to reproduce because dotnet build support for WinUI is currently in progress. However the attached binlog should contain the required data.

msbuild.binlog.zip

Expected Behavior

GetInstalledSDKLocations should be available under .NET 6

Actual Behavior

The following build error

error MSB4062: The "Microsoft.Build.Tasks.GetInstalledSDKLocations" task could not be loaded from the assembly Microsoft.Build.Tasks.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Analysis

It looks like this Task was removed from the Core build of Microsoft.Build.Tasks.Core.

Versions & Configurations

dotnet --version
6.0.201

@dellis1972 dellis1972 added bug needs-triage Have yet to determine what bucket this goes in. labels Mar 9, 2022
@dellis1972
Copy link
Author

Also missing is ResolveSDKReferences.

@Forgind Forgind removed the needs-triage Have yet to determine what bucket this goes in. label Mar 10, 2022
@eerhardt
Copy link
Member

@rainersigwald - do you know why GetInstalledSDKLocations is only compiled on .NET Framework?

<ItemGroup Condition="$(TargetFrameworkIdentifier) == '.NETFramework'">
<Compile Include="Al.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AppDomainIsolatedTaskExtension.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AspNetCompiler.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AssemblyDependency\GacResolver.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AssemblyDependency\GlobalAssemblyCache.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AssemblyRegistrationCache.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AxImp.cs" />
<Compile Include="AxReference.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AxTlbBaseReference.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="AxTlbBaseTask.cs" />
<Compile Include="ComDependencyWalker.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="ComReference.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="ComReferenceInfo.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="ComReferenceItemAttributes.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="ComReferenceResolutionException.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="ComReferenceTypes.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="ComReferenceWrapperInfo.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="GenerateBootstrapper.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="GenerateTrustInfo.cs" Condition="'$(MonoBuild)' != 'true'">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="GetFrameworkSDKPath.cs">
<ExcludeFromStyleCop>true</ExcludeFromStyleCop>
</Compile>
<Compile Include="GetInstalledSDKLocations.cs" />

@rainersigwald
Copy link
Member

@eerhardt No particularly good reason. We plan to fix for 17.3.

(The reason is "it wasn't needed until now and there was some roadblock porting it to .NET Core pre-1.0 so we just didn't".)

@rainersigwald rainersigwald added this to the VS 17.3 milestone Apr 25, 2022
@eerhardt
Copy link
Member

eerhardt commented Apr 25, 2022

Hopefully 🤞 this is the last change needed for WinUI (and Maui Windows) apps to work correctly with dotnet build. We have it working if we skip the steps that need GetInstalledSDKLocations (which Maui does by default today with https://github.com/dotnet/maui/pull/5923/files#diff-2fda9742af9d1dcd9809679145355f4775b31715e2f879d2f765375867ee1b1eR7).

@sude22
Copy link

sude22 commented Jun 7, 2022

It would be very welcome if this error would be investigated.
Currently it is not possible to deloy a WinUI3 App unpacked as SingleFile via CI/DevOps.
Neither with msbuild nor with dotnet publish.

@rainersigwald
Copy link
Member

@sude22 can you please file a new issue describing your problems in that scenario when using msbuild.exe to build? If that's not working, this issue doesn't track the fix.

@rainersigwald rainersigwald added .NET Core Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. and removed bug labels Jun 21, 2022
rainersigwald added a commit that referenced this issue Jun 23, 2022
Build some tasks for .NET 6 that were previously .NET Framework only (but are really Windows-only, and should work fine in `dotnet build`).

Fixes #7452
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Tasks Issues impacting the tasks shipped in Microsoft.Build.Tasks.Core.dll. .NET Core triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants