How can I Import / Include a file containing references to static content files for Xamarin Studio / MonoTouch

StackOverflow https://stackoverflow.com/questions/22464849

  •  16-06-2023
  •  | 
  •  

Question

I have a Xamarin Solution were I have two different iOS projects in it - but both of these are sharing the same static content (HTML, JS, CSS++). I'd love to be able to use a target file or similar to be able to include a common file holding a reference to all these files.

When I try and add a directive - it does not seem to respect that at all, not in Xamarin studio, nor when I actually build.

Was it helpful?

Solution

You should be able to make an iOS class library project and include these files in it with a build action of BundleResource. I generally do this with binding projects where the Obj-C library includes a bunch of files you need to include with your app (it works for normal libraries, too though).

When referencing the library, it should copy the files to your application bundle. Keep in mind, however, you probably need to actually have some code in the class library you are calling from the main iOS application project. Xamarin.iOS may strip out the library if code inside is not being used.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top