Sdk: Content from library is not deployed to UWP app

Created on 27 Oct 2017  路  6Comments  路  Source: dotnet/sdk

_From @zigzag312 on October 26, 2017 12:22_

Hi, I am not sure if this is a bug or a proper behavior. To reproduce:

  1. (in Visual Studio) create UWP project
  2. create netstandard project
  3. add a content file to netstandard project (mark it as 'Content' and set it to 'Copy if newer')
  4. from UWP project add reference to netstandard project
  5. run in debug mode (without .NET Native tool chain)

Result: Content file will be copied to bin/Debug folder on build, but it will NOT be copied/deployed to bin/Debug/AppX folder.

  1. Why does content file get copied on build, but it doesn't get deployed in the end?
  2. How can I properly add content to referenced project so that it will get deployed to UWP app?

I am using Visual Studio 2017 v15.4.1 on Windows 10 Fall Creators Update

_Copied from original issue: dotnet/project-system#2925_

Most helpful comment

Any info on this?

All 6 comments

Any info on this?

Having this same issue on a Xamarin UWP app. I have a .NET Standard library that contains a json file that I've specified as build action "Content" and "Copy if newer" or "Copy always". It never gets deployed! Is there a workaround for this?

I'm using VS2017 Enterprise and running Windows 10 Version 1803.

Workaround here would be to put the content file inside the UWP project or in a Shared Project which you will reference from your UWP project. Content files directly in the UWP app project will be deployed correctly. The problem here occurs only with content files in a separate library.

@MartinZikmund Oh boy, I really don't like that workaround. All of my content files are related only to the .NET Standard library project, not the UWP project that references it. I also use this .NET Standard project as a reference to a WPF project, and that setup works fine. I guess I'll have to duplicate a "copy" of each content file now into my UWP project.

Unfortunately it is the only workaround I have found so far...

Following hack worked for me: https://stackoverflow.com/questions/3610845/add-as-link-for-folders-in-visual-studio-projects
Far from perfect, but better than manually copying files to UWP project.

Was this page helpful?
0 / 5 - 0 ratings