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: https://bugzilla.xamarin.com/show_bug.cgi?id=25569

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

packages.config:

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

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

Company.iOS.csproj:

-<ProjectTypeGuids>{6BC8ED88-2882-458C-8E55-DFD12B67127B};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

+<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

+<TargetFrameworkIdentifier>Xamarin.iOS</TargetFrameworkIdentifier>

+<TargetFrameworkVersion>v1.0</TargetFrameworkVersion>

-<Reference Include="monotouch" />

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

-<HintPath>..\packages\Xamarin.Forms.1.3.1.6296\lib\MonoTouch10\Xamarin.Forms.Platform.iOS.Classic.dll</HintPath>

-</Reference>

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

-<HintPath>..\packages\Xamarin.Forms.1.3.1.6296\lib\MonoTouch10\Xamarin.Forms.Core.dll</HintPath>

-</Reference>

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

-<HintPath>..\packages\Xamarin.Forms.1.3.1.6296\lib\MonoTouch10\Xamarin.Forms.Xaml.dll</HintPath>

-</Reference>

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

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

+<HintPath>..\packages\Xamarin.Forms.1.3.1.6296\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll</HintPath>

+</Reference>

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

+<HintPath>..\packages\Xamarin.Forms.1.3.1.6296\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll</HintPath>

+</Reference>

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

+<HintPath>..\packages\Xamarin.Forms.1.3.1.6296\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>

+</Reference>

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

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

Posts

  • 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]

    ...[clipped]...
    

    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 environment..is it fair enough?

    regards

    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. http://forums.xamarin.com/discussion/29934/xamarin-forms-1-3-0-released#latest

  • 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.

    Thanks,
    Paul.

  • 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. https://bugzilla.xamarin.com/show_bug.cgi?id=26048#c0 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.

    Attempts:
    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"
                    DependsOnTargets="_CollectBundleResources"
                    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)')" >

    in

    /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/lib/mono/2.1/Xamarin.iOS.Common.targets

  • hewittcarlhewittcarl CAMember

    I did not find

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

Sign In or Register to comment.