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

Xaml file with ResourceDictionary does not get added on Pack #77

Closed
MSiccDev opened this issue May 31, 2018 · 8 comments · Fixed by #84
Closed

Xaml file with ResourceDictionary does not get added on Pack #77

MSiccDev opened this issue May 31, 2018 · 8 comments · Fixed by #84

Comments

@MSiccDev
Copy link

MSiccDev commented May 31, 2018

I want to add a style in my NuGet package for using it in a custom renderer for UWP. I created a Themes folder, added Generic.xaml, but I am not able to get it into the NuGet package.

I am using multi targeting in this library, in a similar way Xamarin.Essentials does. The package structure shows a .pri file besides the dll, but the themes folder never shows up.

What am I missing?

@Nirmal4G
Copy link
Contributor

Nirmal4G commented May 31, 2018

Use it like this:

<ItemGroup>
    <Resource Include="Themes\*.xaml" Pack="true" PackagePath="uap10.0\Themes\"/>
</ItemGroup>

@clairernovotny
Copy link
Collaborator

You need to set/add <GenerateLibraryLayout>true</GenerateLibraryLayout>. The files will get included automatically then.

@Nirmal4G
Copy link
Contributor

I forgot about that.

@MSiccDev
Copy link
Author

MSiccDev commented May 31, 2018

Problem is that I already set GenerateLibraryLayout to true, but the xaml file was not added. Maybe this is a problem with the Multi targeting setup I have for Xamarin Forms. :\

Also, the Resource trick did not really work...

@Nirmal4G
Copy link
Contributor

Will look into it.

@MSiccDev
Copy link
Author

MSiccDev commented May 31, 2018

So trying to get this working, I added <IncludeContentInPack>true</IncludeContentInPack> and in the UWP condition <Content Include="**\*.uwp.xaml" Pack="true" PackagePath="**\*"></Content>
after changing the ResourceDictionary's file name and placed it besides the control - the file now gets included in the NuGet package...

tbh, this seems very hacky to me...

@Nirmal4G Nirmal4G mentioned this issue Jun 1, 2018
8 tasks
@Nirmal4G
Copy link
Contributor

Nirmal4G commented Jun 17, 2018

Also, the Resource trick did not really work...

The Resource and other build items work only when both IncludeContentInPack property and Pack metadata (on that Item type) is set to true!

You don't need a separate Content item definition to get it working, i.e. use the same trick I mentioned and just add <IncludeContentInPack>true</IncludeContentInPack>. Any standard Item type having Pack metadata is included automatically.

@Nirmal4G Nirmal4G mentioned this issue Jun 20, 2018
5 tasks
@MSiccDev
Copy link
Author

will try that, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants