Creating archive via xbuild

How can i ?

Deprecated mdtool supported archive option, what about xbuild ?

Best Answer

Answers

  • GrigoryPerepechkoGrigoryPerepechko USMember ✭✭
    edited June 2015

    I see an article - http://developer.xamarin.com/guides/cross-platform/ci/teamcity/ which describes how to integrate with teamcity, but, Xamarin guys, you write there about mdtool! And at the same time you say that it is deprecated and for Unified projects it is better to use xbuild.

    Please provide better documentation for basic features of the product you sell!

  • I second that, how do you create an archive with xbuild as you ask us to move away from mdtool ?

  • Up!

  • HumorWinsHumorWins USMember
    edited September 2015

    Same, we'd like our build server to produce enterprise and store builds. It's pretty difficult to set this up if the tools don't support doing it without a person manually clicking stuff.

    To be clear I followed the directions to produce an enterprise build IPA. You get an IPA but it's not signed and not suitable for distribution. I suppose I need to go figure out how to resign it myself but come on guys, that's a really lame way to go about this.

  • Craig_HorsfieldCraig_Horsfield USMember ✭✭
    edited October 2015

    After much trying it does not work to set the Target to Archive. There are a lot of dependencies in the build \ archive process that fail. Looks like you should not call Archive as the target.

    This seems to work in you IOS project just add this to you app store Store configuration section for the project

    **Add this  <ArchiveOnBuild>true</ArchiveOnBuild>**
    
    **<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'AppStore|iPhone' ">
        <ArchiveOnBuild>true</ArchiveOnBuild>
        <Optimize>true</Optimize>
        <OutputPath>bin\iPhone\AppStore</OutputPath>**
    
  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Good catch Craig, thanks! I have edited the example command line in my previous post accordingly:

    xbuild /p:Configuration=Release /p:Platform=iPhone /p:ArchiveOnBuild=true /t:"Build" MyProject.csproj
    
    • The "Archive" target does indeed depend on some of the outputs from the "Build" target, so it is mandatory to run the "Build" target.
    • The "Archive" target will only run if ArchiveOnBuild is set to true.
    • The "Archive" target will run automatically as part of the "Build" target when ArchiveOnBuild is true, so it's sufficient to use /t:"Build".
  • Would it work on Xamarin 8.9 ? Or it is something new from Xamarin 9.2

  • BrendanZagaeskiBrendanZagaeski USForum Administrator, Xamarin Team Xamurai

    Would it work on Xamarin 8.9 ? Or it is something new from Xamarin 9.2

    The "Archive" target does indeed require Xamarin.iOS 9.0 or higher (currently available in the Stable updater channel). In Xamarin.iOS 8.x the .xcarchive logic was only available for mdtool.

  • GuillaumeGirardGuillaumeGirard CAMember ✭✭
    edited October 2015

    @BrendanZagaeski I was going to contact support prior to find this thread :)
    Do you have any idea if your team planned to support it also from VS? looks like a must to have for me since crashes are integrated in XCode organizer...

    Edit: Looks like command line is working fine from msbuild command line too... especially if you are using the correct version specified in the post just above ^^ Great work!

  • GuillaumeGirardGuillaumeGirard CAMember ✭✭
    edited October 2015

    There is a missing REQUIRED parameter for the info.plist file contained in the .xcarchive file => CFBundleVersion must be specified in addition to CFBundleShortVersionString.
    If this string is not present, the archive will not be associated to the right iOS app and will instead appear as "Other Items"

  • EricLouvardEricLouvard DEMember
    edited December 2015

    Is there any way to specify the .xcarchive package destination? Since xcode 5 it is possible to set it with -archivePath and I'm missing this option in xcode and mdtool
    (ref: http://stackoverflow.com/a/20905823/281188)
    The exact location (depending on timestamp) where the last archive has been saved would also help ;)

  • _albertoms_albertoms MXUniversity ✭✭

    Hi,

    Does anyone solved the issue that @GuillaumeGirard has pointed out? xbuild creates the Info.plist without the CFBundleVersion string. I'm running the xbuild command from jenkins in order to make a valid TestFlight build.

  • _albertoms_albertoms MXUniversity ✭✭
    edited April 2016

    @albertomslg said:
    Hi,

    Does anyone solved the issue that @GuillaumeGirard has pointed out? xbuild creates the Info.plist without the CFBundleVersion string. I'm running the xbuild command from jenkins in order to make a valid TestFlight build.

    Update to my previous comment:

    I succeeded uploading a valid TestFlight build with the command line tool Pilot, but in the Archives list the Bundle Version is not shown. It seems that not adding the CFBundleVersion to the Info.plist created with xbuild is not such a serious issue.

  • RyanThompsonRyanThompson USUniversity ✭✭

    For anyone else who is running into this issue with CFBundleVersion not being set, I had my build pipeline execute this command after the archive was created to insert the correct build number into the Info.plist

    /usr/libexec/PlistBuddy -c "Add :ApplicationProperties:CFBundleVersion string "your build number here"" path/to/archive.xcarchive/Info.plist
    
  • KashifShaikhKashifShaikh CAMember ✭✭

    This is fun - late last year when I was creating out build scripts, Xamarin CI setup said to use mdtool as you can see in the wayback machine here: https://web.archive.org/web/20151124033608/https://developer.xamarin.com/guides/cross-platform/ci/teamcity/

    Now it's broken - sheesh. Now I have to figure out how to get the same results using xbuild. Why don't they announce or write documents telling us what is changing, and why?

    Regular enterprise companies would never do this - including Microsoft.

  • iphooiphoo BYMember ✭✭

    Microsoft Visual Studio Professional 2015
    Version 14.0.25431.01 Update 3
    Xamarin.iOS 10.3.1.8 (7beaef4)

    I have following error in VS if I do add:

    <ArchiveOnBuild>true</ArchiveOnBuild>
    

    to my project file.

    The "Xamarin.Messaging.Tasks.CreateArchiveDirectory" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Xamarin\iOS\Xamarin.Messaging.Tasks.dll. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

    In spite of this error I can find xcarchive file in $HOME/Library/Developer/Xcode/Archives, but for some reason there are two files produced during single build:

    What is wrong here?

  • iphooiphoo BYMember ✭✭

    Just found this thread about error, so its clear now.

    But question about 2 two archive files is still open.

Sign In or Register to comment.