Wilson Vargas
Wilson Vargas

Reputation: 2899

Add a file to folder from nuget package not work in UWP

I've create a Nuspec file to build my nuget package for a control to Xamarin.Forms.

I want add a .ttf file into Assets/Fonts I've been able to add it using:

<file src="ButtonCircle\ButtonCircle.FormsPlugin.UWP\Assets\Fonts\MaterialIcons-Regular.ttf" target="content\Assets\Fonts" />

but only added to PCL, Android and iOS projects, it's not possible to add to the UWP project.

see the project solution explorer using this control

I'm using Nuget 2.8.1

How can I add this file to UWP project?

Upvotes: 2

Views: 471

Answers (2)

Sharada
Sharada

Reputation: 13611

In extension to @nico-zhu-msft answer; make sure you clear nuget cache on your DEV system before testing newly created packages; or at least increment the version number to force VS to load package from the right source.

Basically, in order to avoid issues related to local caching; delete packages from these directories:-

%LocalAppData%\NuGet\Cache

and

%userprofile%\.nuget\packages\

There is a pretty good chance the reason you are not seeing any change is because VS is still installing from locally cached version (which is the older package without your new changes).

More details : Cached nuget packages causing you problems?

Upvotes: 0

Nico Zhu
Nico Zhu

Reputation: 32785

I've create a Nuspec file to build my nuget package for a control to Xamarin.Forms.

I want add a .ttf file into Assets/Fonts.

NuGet uses target framework references in a variety of places to specifically identify and isolate framework-dependent components of a package. To include platform-specific reference assemblies, add the following to the element of .nuspec as appropriate for your uwp platform(UAP10).

<file src="ButtonCircle\ButtonCircle.FormsPlugin.UWP\Assets\Fonts\MaterialIcons-Regular.ttf" target="content\UAP10\Assets\Fonts\MaterialIcons-Regular.ttf"/>

For more, you could refer to Create cross-platform packages.

Upvotes: 1

Related Questions