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

NuGet package lib folder content is not copied to output path of Packaged WinUI 3 apps #6429

Open
1 of 2 tasks
dahovey opened this issue Dec 2, 2021 · 5 comments
Open
1 of 2 tasks
Labels
area-Tooling bug Something isn't working product-winui3 WinUI 3 issues team-Markup Issue for the Markup team wct

Comments

@dahovey
Copy link

dahovey commented Dec 2, 2021

Describe the bug

When a NuGet package includes additional files in the lib folder, these files are not copied to the OutputPath of a Packaged WinUI 3 application, but additional files in the lib folder are copied to output path if the project is a Class Library for WinUI 3. In order to get the additional files to be copied to the output of the Packaged app, a class library is needed and a project reference is required from the Packaged app to the Class Library.

In my case I am trying to use FontAwesome5 version 2.1.6 which includes support for WinUI 3. See screenshot below of NuGet package structure.

Steps to reproduce the bug

  1. Create WinUI 3 Packaged app for Desktop using VS2022 project templates.
  2. Add ProjectReference to FontAwesome5 version 2.1.6
  3. Build project
  4. Open output folder in File Explorer and observe there is not FontAwesome5 folder within output.

What works:

  1. Create WinUI 3 ClassLibrary project using VS2022 project templates.
  2. Add ProjectReference to FontAwesome5 version 2.1.6
  3. Build project
  4. Open output folder in File Explorer and observe there IS FontAwesome5 folder within output.

Expected behavior

Additional files within NuGet package should be copied to output regardless of project type.

Screenshots

image

NuGet package version

WinUI 3 - Windows App SDK 1.0 (If you're seeing your issue in older previews of WinUI 3, please try this release)

Windows app type

  • UWP
  • Win32

Device form factor

Desktop

Windows version

May 2020 Update (19041)

Additional context

No response

@ghost ghost added the needs-triage Issue needs to be triaged by the area owners label Dec 2, 2021
@dahovey
Copy link
Author

dahovey commented Dec 2, 2021

In addition to above, when I create a control library NuGet package that depends on FontAwesome and other packages I receive the following errors:

1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "C:\Users\dahov\.nuget\packages\controlLibrary.winui\0.4.155\lib\net6.0-windows10.0.19041\controlLibrary.WinUI\runtimes\win-arm64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "C:\Users\dahov\.nuget\packages\controlLibrary.winui\0.4.155\lib\net6.0-windows10.0.19041\FontAwesome5.WinUI\Fonts\Font Awesome 5 Brands-Regular-400.otf" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "C:\Users\dahov\.nuget\packages\controlLibrary.winui\0.4.155\lib\net6.0-windows10.0.19041\controlLibrary.WinUI\runtimes\win-x86\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "C:\Users\dahov\.nuget\packages\controlLibrary.winui\0.4.155\lib\net6.0-windows10.0.19041\controlLibrary.WinUI\runtimes\win-x64\native\WebView2Loader.dll" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "C:\Users\dahov\.nuget\packages\controlLibrary.winui\0.4.155\lib\net6.0-windows10.0.19041\FontAwesome5.WinUI\Fonts\Font Awesome 5 Free-Regular-400.otf" because it was not found.
1>C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5100,5): error MSB3030: Could not copy the file "C:\Users\dahov\.nuget\packages\controlLibrary.winui\0.4.155\lib\net6.0-windows10.0.19041\FontAwesome5.WinUI\Fonts\Font Awesome 5 Free-Solid-900.otf" because it was not found.

In this case the FontAwesome5 library includes the Font assets in its own package, but the build is expecting the assets to be included in the control library package.

@gabbybilka gabbybilka added the product-winui3 WinUI 3 issues label Feb 8, 2022
@StephenLPeters StephenLPeters added area-Tooling team-Markup Issue for the Markup team labels Feb 24, 2022
@StephenLPeters
Copy link
Contributor

@evelynwu-msft FYI

@jeromelaban
Copy link

jeromelaban commented Oct 13, 2022

I can confirm this is still not working as of WinAppSDK 1.2.220930.4-preview2. This is caused by this piece in the targets and props files:

1.2.220930.4-preview2\buildTransitive\MrtCore.targets

  <!-- We want MRT Core to NOT be used in WAP or UWP projects. Instead, we want the in-box PRI generation tooling to be used. -->
  <PropertyGroup>
    <EnableCoreMrtTooling Condition="'$(EnableCoreMrtTooling)'=='' and '$(WindowsAppContainer)'!='true' and '$(MSBuildProjectExtension)' != '.wapproj'">true</EnableCoreMrtTooling>
  </PropertyGroup>

1.2.220930.4-preview2\buildTransitive\Microsoft.Build.Msix.Common.props

    <!-- We are currently incompatible with the MRT Core tooling (conflicts due to duplicated,
         but not identical, logic and race conditions that depend on order of Nuget imports). For now
         we will disable the MRT Core tooling with an eye on resolving the incompatibilities once we
         share a repo. Tracked by http://task.ms/31928041-->
    <EnablePriGenTooling>false</EnablePriGenTooling>
    <EnableCoreMrtTooling>false</EnableCoreMrtTooling>

Running unpackaged enables EnablePriGenTooling, which in turn enables AddPriPayloadFilesToCopyToOutputDirectoryItems which properly extracts the files from the imported NuGet pri files and places the assets in the output layout.

This is causing issues for library authors that need to include assets, and forces app developers to run unpackaged.

@bpulliam bpulliam removed the needs-triage Issue needs to be triaged by the area owners label Dec 6, 2022
@michael-hawker
Copy link
Collaborator

michael-hawker commented Jul 13, 2023

Bumping, based on #8638

@bpulliam there's a number of issues that have suggested fixes, solid repros, or are regressions. Would be great to have a marker for those as the team triages to bubble some of the low-hanging fruit up to get some easy wins?

@duncanmacmichael duncanmacmichael added the bug Something isn't working label Oct 31, 2023
@kjean667
Copy link

kjean667 commented Oct 14, 2024

Still not working in WindowsAppSDK 1.6.240923002.

The problem is now even worse in 1.6 since an indirect reference through a second wrapper library does not work for the decoupled WebView2 versioning made in 1.6 (see microsoft/WindowsAppSDK#4807 and MicrosoftEdge/WebView2Feedback#4837).
When trying to compile the wrapper library that reference a nuget package that references WindowsAppSDK 1.6.240923002 it produces the following compile error:

C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(5321,5): error MSB3030: Could not copy the file "C:\Users\my-user\.nuget\packages\myuilibrary\1.2.1\lib\net8.0-windows10.0.22621\MyUILibrary\runtimes\win-x64\native\WebView2Loader.dll" because it was not found.

The compile error only appears when referencing the nuget package in a library, which makes this bug (#6429) important to solve again.

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

No branches or pull requests

8 participants