Debugging/Deploying app without uninstall

I need to test database migration processes on-device/in the simulator, but the default behavior of Xamarin in Visual Studio is to completely uninstall the previous version of the app before it installs the new one. Is there a way to set up the deployment process so that it will just install the new version of the app as an upgrade instead acting like a clean install?

Tagged:

Answers

  • CheesebaronCheesebaron DKInsider, University mod

    Go to Tools>Options>Xamarin and set Preserve application data/cache on device between deploys

  • MattBaker.7976MattBaker.7976 USMember

    Sweet, I knew there had to be a way. I'll try this tonight. Thanks!

  • MattBaker.7976MattBaker.7976 USMember

    @Cheesebaron I don't think this worked. I checked that setting but still get this when I debug:

    1>Build succeeded.
    1>Waiting for device..
    1>Detecting installed packages
    1>Detecting installed packages...
    1>
    1>Removing previous version of application
    1>Removing previous version of application...
    1>
    1>Installing application on device
    1>Copying application to device...

    I don't want it to do the 'Removing' portion.

  • MattBaker.7976MattBaker.7976 USMember

    Even turning Fast Deployment on doesn't do that.

  • MattBaker.7976MattBaker.7976 USMember

    Ya, definitely not working. I even factory reset my development device to no avail. Upgrading to 3.9.547 to see if anything is fixed there.

  • MattBaker.7976MattBaker.7976 USMember

    Still nothing on the latest version of Xamarin...unless I'm misunderstanding what it means to 'Preserve' this data...

  • MattBaker.7976MattBaker.7976 USMember

    OK, so it looks like Xamarin for Visual Studio doesn't honor this setting, but Xamarin Studio does. I guess I'll have to use XStudio for the purpose of debugging...

  • MattBaker.7976MattBaker.7976 USMember

    and now it doesn't deploy the app during debugging at all......................

    Xamarin Studio

    Detecting installed packages

    Waiting for packaging to complete

    Terminating running application

    Deployment completed

    Visual Studio

    2>Build started.
    2>Build succeeded.
    2>Waiting for device..
    2>Detecting installed packages
    2>Detecting installed packages...
    2>

  • MattBaker.7976MattBaker.7976 USMember

    I give up. This feature appears to be completely broken across both VS and XStudio. Even if the version number of the app I'm debugging/deploying is greater than the one currently installed it will sometimes completely remove it before installing the new one. Here is the scenario I'm trying to test:

    1. Install current version from Google Play, login, do some stuff.
    2. Debug the latest code on the device, leaving its shared settings/data/cache in place (this built debug binary is signed with the exact same certificate as Production)

    No matter what I try it will not stop doing a Remove/Install. Even Xamarin Studio is so confused that it seems to think that the Google Play app version matches the version I'm trying to debug, so doesn't deploy the new version at all.

    @Cheesebaron any ideas?

  • CheesebaronCheesebaron DKInsider, University mod

    Dunno, works fine when I debug with my devices.

  • MattBaker.7976MattBaker.7976 USMember

    @Cheesebaron if this feature is working as expected it should skip the "Removing previous version of application" portion of the deploy process, correct?

  • JaredBagleyJaredBagley USMember ✭✭

    @MattBaker.7976 Just confirming this feature does not work correctly for me either. I have a Nexus 5 and a Samsung Note 8, both of which lose the current version of the application when deploying. This does not happen when using GenyMotion but then I can't test bluetooth features. I wish someone could offer a solution.

  • BrettCook.2935BrettCook.2935 USMember, University

    Sorry for resurrecting an old thread, but I found out something about this.

    If I'm using a rooted android phone, this does not work for me. If I'm using a non-rooted phone, this does work for me.

    If any of your test devices are rooted, this may have something to do with it.

  • MatthewWaring.4722MatthewWaring.4722 GBUniversity ✭✭

    Another note FOI: My device is not rooted and visual studio 2017 seems to be wiping things out on each Debug run to a real device LG G5!

  • PhilipGruebelePhilipGruebele USMember ✭✭

    Same problem here with rooted Honor Note 8
    The app's files are deleted with every debug session.

  • dpedrinhadpedrinha DEMember ✭✭✭

    Same problem here.

  • ElteHupkesElteHupkes USMember ✭✭

    This actually just started happening to me after a Xamarin update. This used to work fine with my (non-rooted) Sony Xperia, but now data is definitely removed before every debugging session. In addion, deploys take forever.

    Data is not removed with the VS Emulator for Android though. Clueless what is going on here.

  • @ElteHupkes said:
    This actually just started happening to me after a Xamarin update. This used to work fine with my (non-rooted) Sony Xperia, but now data is definitely removed before every debugging session. In addion, deploys take forever.

    Data is not removed with the VS Emulator for Android though. Clueless what is going on here.

    Any fixes for this? I have the same problem.

  • ElteHupkesElteHupkes USMember ✭✭

    @IvanVelichkovski Unfortunately I haven't found any yet.

  • DrCJonesDrCJones USMember
    edited September 2017

    It is working with iOS simulator.

  • BenjaminPettitBenjaminPettit USMember ✭✭
    edited February 2018

    Broken for both android and iOS for me, im using VSFM(Visual studio for mac).
    Visual Studio Community 2017 for Mac
    Version 7.3 (build 799)
    Xamarin.Android
    Version: 8.1.0.24
    Xamarin.iOS
    Version: 11.6.1.2 (Visual Studio Community)
    Hash: 6857dfcc
    Branch: xcode9.2
    Build date: 2017-12-04 21:20:41-0500

  • BenjaminPettitBenjaminPettit USMember ✭✭

    Im happy to announce updating to:
    Visual Studio Community 2017 for Mac
    Version 7.3.3 (build 12)

    Has since fixed this issue.

  • andrewleaderandrewleader Member
    edited December 2018

    Same problem here, non-rooted Google Pixel 2, and Visual Studio 2017 15.6.7 for Windows with Xamarin 4.9.0.753.

    This used to work fine a year or two ago, but then suddenly it started wiping my app every time I make a small code change and deploy. Makes Xamarin almost completely useless :/

    A blank new Xamarin project writing to Preferences doesn't seem to have this problem, so it's something different with my actual, more complicated project... but none of the suggestions here work.

    I've somewhat narrowed down the issue. In my complex project, if I edit any of the layout .axml files and deploy, it uninstalls and reinstalls. But if I just edit the .cs files in my project, it'll deploy fine without wiping my data. But in the blank new project, editing layout files works fine.

  • andrewleaderandrewleader Member

    Update: VS 15.9.4 for Windows seems to have fixed the problem so far! I was previously on 15.6. I hope this stays fixed!

  • kkarakkkkarakk Member ✭✭

    update 15.9.5, issue remains

  • _andyng_andyng Member ✭✭

    VS 7.7.3 for Mac has the same problem.
    Debugging on real device wiping all of its data.

    Issue reported, hope this is the last issue we are facing for Xamarin app maintaining, after this no more XAMARIN.

  • HortinzHortinz GBMember ✭✭

    @_andyng could you post the link for the issue reported? It's embarrassing this still happens.

  • EdwardKEdwardK Member

    same error here trying to debug without wiping data.

    agree with @_andyng, simple things starting up but later it's getting difficult with XAMARIN

    unchecking the deploy, no luck : needs to be deployed before it can be started. Verify the project is selected to be deployed in the Solution Configuration Manager.

  • nick5454nick5454 USUniversity ✭✭✭

    Yes it no worky

Sign In or Register to comment.