Copy existing data base (storage file) to storage folder RRS feed

  • Question

  • In my Windows Store App I want to copy existing data base to storage folder.
    My data base placed on main folder of project.

    For copy data table to storage folder I use following code:

    StorageFile databaseFile = await Package.Current.InstalledLocation.GetFileAsync("people.sqlite");
    await databaseFile.CopyAsync(ApplicationData.Current.LocalFolder);

    And all works great in VS in debug mode.
    But if I use release mode or just stop debug and open my app from Windows - it doesn't work.

    Also no exception was thrown. App just freeze when try to call `CopyAsync`.

    I'm sure, that my `databaseFile!=null` in release mode too.

    Also I tried to get file like this:

    var uri = new Uri("ms-appx:///people.sqlite");
    var file = await StorageFile.GetFileFromApplicationUriAsync(uri);

    But it doesn't solve my problem.

    Question: What is the right way to copy existing data base to storage folder?

    Friday, January 10, 2014 2:24 PM

All replies

  • That looks correct, barring explicitly setting the collision behavior.

    Does it fail on all machines or only on one? If you reattach the debugger when it's frozen does it keep going or can you examine what it's doing in the bad state?


    Friday, January 10, 2014 4:49 PM