CommunityToolkit / Microsoft.Toolkit.Win32

ARCHIVE - This repository contained XAML Islands wrapper controls and tooling for XAML Islands with WinUI 2, see readme for more info about XAML Islands with WinUI 3 and the WindowsAppSDK.
https://aka.ms/windowsappsdk
Other
384 stars 89 forks source link

MSB4175 The task factory "CodeTaskFactory" could not be loaded from the assembly #331

Closed michalleptuch closed 2 years ago

michalleptuch commented 2 years ago

Describe the bug

I just formated my PC, installed Windows 11 (22000.194) and installed VS 2019 and 2022 P4.1. I can't build any project that has reference to Microsoft.Toolkit.Wpf.UI.XamlHost. The same issue occured in projects with win2d.uwp package.

Message from Output window:

MSB4175 The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\Microsoft.Build.Tasks.Core.dll". The system cannot find the path specified
C:\Users\Michał\.nuget\packages\microsoft.toolkit.win32.ui.sdk\6.1.2\build\Microsoft.WinRT.Win32.targets:207

I checked if Microsoft.Build.Tasks.Core.dll exists. Permissions are correct. I didn't install any others applications and addons. I installed Windows 11 twice, tried to repair both VS 2019 and 2022 and still doesn't work.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Install fresh Windows 11 RTM version
  2. Install Visual Studio 2019 or 2022 Preview 4.1
  3. Clone and build sample project: https://github.com/michalleptuch/rounded-flyout

Expected behavior

Projects build correclty.

Environment

NuGet Package(s): 
Microsoft.Toolkit.Wpf.UI.XamlHost 6.1.2

Package Version(s): 

Project .NET Version:
- [ ] .NET Framework (version: )
- [ ] .NET Core 3
- [x] .NET Core 3.1

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] Windows 11 22000.194

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [x] May 2019 Update (18362)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio 
- [ ] 2017 (version: )
- [x] 2019 (version: 16.9.8) 
- [x] 2022 Preview 4.1
ghost commented 2 years ago

Hello michalleptuch, thank you for opening an issue with us!

I have automatically added a "needs triage" label to help get things started. Our team will analyze and investigate the issue, and escalate it to the relevant team if possible. Other community members may also look into the issue and provide feedback 🙌

michalleptuch commented 2 years ago

Okay, error occurs when Windows user folder (C:\Users\UserName) has custom characters (e.g. ł, ź, ę).