After upgrading to Unified API resources (images) aren't being added to bundle

Shane000Shane000 USMember ✭✭✭
edited January 2015 in Xamarin.Forms

Has anyone seen anything like this? They worked before and nothing crazy looks different in the diff.

1) Found because all images return null.

2) All images are BundleResource and that hasn't changed

3) Looking inside the bundle it doesn't look like the images are anywhere inside it.

4) I JUST found this bug, I'm hoping it's related:

besides namespaces and a handful of RectangleF->CGRect the only changes to my repo are below:


-<package id="Xamarin.Forms" version="" targetFramework="MonoTouch10" />

+<package id="Xamarin.Forms" version="" targetFramework="xamarinios10" />






-<Reference Include="monotouch" />

-<Reference Include="Xamarin.Forms.Platform.iOS.Classic"



-<Reference Include="Xamarin.Forms.Core">



-<Reference Include="Xamarin.Forms.Xaml">



+<Reference Include="Xamarin.iOS" />

+<Reference Include="Xamarin.Forms.Platform.iOS">



+<Reference Include="Xamarin.Forms.Core">



+<Reference Include="Xamarin.Forms.Xaml">



-<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.MonoTouch.CSharp.targets" />

+<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />


  • Shane000Shane000 USMember ✭✭✭
    edited January 2015

    I have cleaned everything. Restarted my mac. Deleted all bin/obj folders and it still won't work.

    My build output has this in it:

    Target _CollectBundleResources: CollectBundleResources Task BundleResources: Resources/[email protected] Resources/login_company_logo.png Resources/[email protected] Resources/[email protected]


    Resources/compose.png Resources/[email protected] Resources/[email protected] OptimizePNGs: True ProjectDir: /Users/shane/GitHub/company.Mobile/iOS ResourcePrefix: Resources

    Target _CoreOptimizePngImages:
    Skipping target "_CoreOptimizePngImages" because its outputs are up-to-date.
    Target _CoreOptimizePngImages:
    Skipping target "_CoreOptimizePngImages" because its outputs are up-to-date.

    ...[Clipped like 80 of the same thing]...

    Target _CoreOptimizePngImages:
        Skipping target "_CoreOptimizePngImages" because its outputs are up-to-date.
  • AlessandroFacchini.8463AlessandroFacchini.8463 ITMember ✭✭
    edited January 2015

    do they have in xamarin a pilot REAL project to test before releasing..? they have had proper holidays (according to what they say) while many of us were testing their never working beta unified version.
    Of course they need our help but now it' becoming a real CHALLENGE at every update...i have to test on a second mac before affecting my final it fair enough?


    Alessandro facchini

  • TomQuistTomQuist USMember

    We just migrated to the unified API and have the exact same problem. Additionally no XIBs have been copied into the bundle which causes the app to crash immediately on start up.

  • Shane000Shane000 USMember ✭✭✭

    I would post in the main 1.3.0 forum post so we get more traction in resolving it.

  • Paul.TellingPaul.Telling GBMember ✭✭

    I also had this problem, so have spent some time digging into it.
    The important part of the build output is:

    Target _CopyContentToBundle:
    No output files were specified for target _CopyContentToBundle, skipping.

    This is the target that actually adds the Bundle Resources to the app output, so as long as it is skipped, no bundled images etc. will be included.

    In my case, I have a PCL project and an iOS project referencing it. Both have package references to Microsoft.Bcl and Microsoft.Bcl.Build.
    Something in the BCL build targets is interfering with the array of files to be used by _CopyContentToBundle, causing it to be empty.
    I've removed the BCL references from my iOS project (but left them in the PCL) and this seems to have fixed the issue. My iOS project now gives me a warning about not referencing BCL, however I've not been able to clear this warning since upgrading to the unified API anyway (this was the only reason I had the reference there in the first place, this may give some hint as to what the underlying problem is).

    I've no idea if this problem is limited to Bcl or is a problem with package references more generally. Obviously, if you really need the reference in your iOS project, this work around isn't going to work.

    I have a sample solution that easily demonstrates the issue, if anyone from Xamarin feels inclined to take a look.


  • Shane000Shane000 USMember ✭✭✭
    edited January 2015

    Wow thanks for looking into it! I have BCL as well in my project! Did you make a bugzilla report? If you make a bugzilla report one of their testers will run that sample project in next day or so and it will get escalated very quickly.

    Edit: nevermind about bugzilla. If we don't even need BCL reference that works enough. I was thinking you had a sample project. Thanks again.

  • Shane000Shane000 USMember ✭✭✭

    I went ahead and posted a bugzilla here about it. If I have time I will make a project for them to test but we don't need Unified API right now and I'm busy, so I'm not in a hurry.

  • JeremyBrooksJeremyBrooks USMember
    edited January 2015

    This really helped me guys. I was hitting this exact issue and have been fighting it for several hours now (uninstalling/reinstalling, cleaning obj and bin files, pulling out hair, etc). I had BCL packages in a PCL because I was referencing Microsoft.Net.Http. Removed the MS.Net.Http and BCL packages, rebuilt and everything seems back to normal now.

  • RudiVisserRudiVisser GBMember
    edited January 2015

    Thanks for everyone that looked into this, issue has been frustrating me.

    Removing the references to Microsoft.Bcl(.Build/.Async) and Microsoft.Net.Http from both the PCL and the iOS projects, then cleaning / rebuilding got the images to show. Obviously had the issue of not being able to use the PortableRest library any more, but adding the references back in and recompiling all of the resources are still working now.

    Not sure 100% how this could be an issue but it certainly needs resolving.

  • Shane000Shane000 USMember ✭✭✭

    @JeremyBrooks‌ Awesome. Thanks for figuring that out. I'm using Miscrosoft.Net.Http as well. Thanks everyone!

  • LuckyDayLuckyDay USMember ✭✭✭

    FYI, this doesn't only affect Unified. I'm still on classic, hit this problem and the DependsOnTargets change fixed it. Not surprising that this affects everyone - Xamarin.Monotouch.CSharp.targets also references Xamarin.iOS.Common.targets.

  • TheCudaTheCuda USMember

    The fix by Anubhav Ranjan does indeed work but it is a ticking bomb. It will occur again and you have to apply this fix again.

  • KeithRoweKeithRowe USMember

    This did not work for me. I have my SQLite database file as a BundledResource, and it cannot load it b/c it is not in the install. Has anyone else found a solution?

  • Shane000Shane000 USMember ✭✭✭

    Did you try the fix @AnubhavRanjan posted? It definitely works for multiple people. I think there is a similar solution on visual studio.

  • KeithRoweKeithRowe USMember
    edited February 2015

    I did. The code from my file is:

    <!-- TODO: check for duplicate items --> <Target Name="_CopyContentToBundle" DependsOnTargets="_CollectBundleResources" Inputs = "@(_BundleResourceWithLogicalName)" Outputs = "@(_BundleResourceWithLogicalName -> '$(_AppBundlePath)%(LogicalName)')" > <Copy SessionId="$(BuildSessionId)" Condition="'$(MtouchTargetsEnabled)'" SourceFiles = "@(_BundleResourceWithLogicalName)" DestinationFiles = "@(_BundleResourceWithLogicalName -> '$(_AppBundlePath)%(LogicalName)')" /> </Target>

    Is there anything else I need to change?

    P.S. the code that used to fetch the db File causing the problems, but no longer finds it, is as follows

    string dbPath = Path.Combine (System.Environment.GetFolderPath (System.Environment.SpecialFolder.Resources), "dbfile.db"); SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS platform = new SQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS (); SQLiteConnection _connection = new SQLiteConnection (platform, dbPath); App.SetDatabaseConnection (_connection);

    (The platform is new with the new SQLite.Net package)

  • IUsikovIUsikov BYUniversity
    edited February 2015

    No solution runs for me. Images located into Common project, aren't available.

    1. Change Xamarin.iOS.Common.targets
    2. Removed Bcl packages from project.
    3. Close xamarin studion / clean / build / rebuild.
    4. Beat the drum and sing prayers.

    <Target Name="_CopyContentToBundle"
                    Inputs = "@(_BundleResourceWithLogicalName)"
                    Outputs = "@(_BundleResourceWithLogicalName -> '$(_AppBundlePath)%(LogicalName)')" >
  • BrandonFryeBrandonFrye USMember
    edited February 2015

    This fix is not working for me - Xamarin - any work on getting this fixed? In my case - I am building directly from my Mac and I am getting this.

  • KeithRoweKeithRowe USMember

    What fixed my issue was I was referring to the named directory, but when I removed any named directory reference (i.e. System.Environment.SpecialFolder.Resources) and just used the file name ("file.jpg") it found it without issue. Good luck.

  • hewittcarlhewittcarl CAMember

    I cannot find

    '$(_AppBundlePath)%(LogicalName)')" >



  • hewittcarlhewittcarl CAMember

    I did not find

    Target Name="_CopyContentToBundle"
    Inputs = "@(_BundleResourceWithLogicalName)"
    Outputs = "@(_BundleResourceWithLogicalName -> '$(_AppBundlePath)%(LogicalName)')"

Sign In or Register to comment.