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

Bundle resources in NuGet package not installed #7258

Closed
babak-f opened this issue Oct 18, 2019 · 5 comments
Closed

Bundle resources in NuGet package not installed #7258

babak-f opened this issue Oct 18, 2019 · 5 comments
Labels
need-info Waiting for more information before the bug can be investigated
Milestone

Comments

@babak-f
Copy link

babak-f commented Oct 18, 2019

I have a NuGet package with a number of files, that should be added to the source code of the target package as bundle resource. But they don't get added.

The NuGet package does not contain a Visual Studio solution (sln), i.e. contains just files.

Steps to Reproduce

  1. Create a NuGet package that contains a number of files. Nuspec file:
<package>
  <metadata>
    <id>...</id>
    <version>...</version>
    <title>...</title>
    <authors>...</authors>
    <owners>...</owners>
    <requireLicenseAcceptance>...</requireLicenseAcceptance>
    <description>...</description>
    <copyright>...</copyright>
    <tags>...</tags>
    <dependencies>
    </dependencies>
    <contentFiles>
      <files include="Resources\*" buildAction="BundleResource" flatten="true" />
    </contentFiles>	
  </metadata>
  <files>
    <file src="Folder1\**\*.*" target="content\Resources\Folder1" />
    <file src="Folder2\**\*.*" target="content\Resources\Folder2" />		
  </files>
</package>
  1. Publish the NuGet package to a package repository
  2. Create a Xamarin iOS project
  3. Install the NuGet package in this project

Expected Behavior

The files be copied into the Resources folder of the Xamarin project's source code, with "bundle resource" as build action.

OR:

The files be copied to the iOS app's target directory as bundle resource, upon buidling the app.

Actual Behavior

No files are copied to the Resources folder. The bundle resources are not present either, once you run the app. I.e., the files are not installed in neither the source directory nor the output directory.

Environment

Microsoft Visual Studio Professional 2019
Version 16.3.5
VisualStudio.16.Release/16.3.5+29411.108
Microsoft .NET Framework
Version 4.8.03752

Installed Version: Professional

Mono Debugging for Visual Studio   16.3.7 (9d260c5)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   5.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

Xamarin.iOS and Xamarin.Mac SDK   13.4.0.2 (e37549b)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

Xamarin   16.3.0.277 (d16-3@c0fcab7)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Also fails on Visual Studio for Mac (latest version).

But it does not fail on Visual Studio for Windows 2017.

Build Logs

No error is logged by the NuGet package installation, and it says that package installation was successful.

Other Remarks

Tried setting the build action to Content (in the nuspec file), which didn't work either.

@whitneyschmidt
Copy link
Contributor

@babak-f Thank you for your feedback!

For us to investigate this further, could you please provide your full build logs, crash reports (if any), solution files (to reproduce) and all your version information. For your issue, it would also be useful if you could include the Nuget package that you are installing.

To get full build logs just set the log verbosity to diagnostic at the following locations:

  • On Visual Studio for Mac: Preferences > Projects > Build
  • On Visual Studio for Windows: Tools > Options > Projects and Solutions > Build and Run

On Visual Studio for Windows you also want to add -v -v -v -v to the mtouch additional arguments by right-clicking the project in the solution explorer and selecting Properties.

Note: this is done automatically on Visual Studio for Mac when the log verbosity is set to diagnostic.

The easiest way to get exact version information:

  • On Visual Studio for Mac: "Visual Studio" menu, "About Visual Studio" item, "Show Details" button.
  • On Visual Studio for Windows: "Help menu", "About Microsoft Visual Studio" item.

Then copy/paste the version information (you can use the "Copy Information" button).

We look forward to hearing from you!

@whitneyschmidt whitneyschmidt added the need-info Waiting for more information before the bug can be investigated label Oct 24, 2019
@whitneyschmidt whitneyschmidt added this to the Future milestone Oct 24, 2019
@PTEC3D50
Copy link

PTEC3D50 commented Nov 6, 2019

Hello there, we have the same issue with our NuGet, we need to include a custom font for our views but we don't add successfully the file.

We use the tutorial from James Montemagno (https://montemagno.com/converting-xamarin-libraries-to-sdk-style-multi-targeted-projects/) for our project, but I try to use the nuspec method but neither the csproj Nuget and the nuspec Nuget have the file. Could you give us some updates ?
Thanks for your time.

NugetTrackResource.zip

@jamesmontemagno
Copy link

So, you are using multi-targeting here with SDK Extras: https://github.com/onovotny/MSBuildSdkExtras usually I would ask questions there as there are special flags usually you need to set to get things packages and it is a third party library.

You will want to update to 2.0.54 to ensure all files are picked up for sure. For Android items the naming of the folder is very important such as how we use it in Essentials: https://github.com/xamarin/Essentials/blob/master/Xamarin.Essentials/Xamarin.Essentials.csproj#L76

I am not sure about iOS, but can ask @onovotny if he has done it

@jamesmontemagno
Copy link

Also, you can look: https://github.com/jsmarcus/Iconize/blob/master/src/Fonts/Plugin.Iconize.FontAwesome/Plugin.Iconize.FontAwesome.csproj which does font bundling. @jsmarcus has a good system there.

@chamons
Copy link
Contributor

chamons commented Nov 11, 2019

It sounds like this is a naming issues and not a macios bug, so I'm going to close it for now.

@chamons chamons closed this as completed Nov 11, 2019
@ghost ghost locked as resolved and limited conversation to collaborators May 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need-info Waiting for more information before the bug can be investigated
Projects
None yet
Development

No branches or pull requests

5 participants