JDo
JDo

Reputation: 358

How to deploy a file in UWP FullTrusted app

I created Install Package project 1809 version and added two apps UWP and Console. I have two applications inside: UWP and console app bridge in full trusted mode. In UWP app I have xml settings file? so I added it in Install Package project too. Is there any way to deploy this file in LocalState folder?

Upvotes: 0

Views: 69

Answers (1)

Nico Zhu
Nico Zhu

Reputation: 32775

so I added it in Install Package project too. Is there any way to deploy this file in LocalState folder?

Sure, you could use CopyAsync method to copy the file to LocalState from package project when app start.

private async void CopyFileToLocal()
{
    try
    {
        var file = await Package.Current.InstalledLocation.GetFileAsync("ss.xml");
        if (file != null)
        {
            await file.CopyAsync(ApplicationData.Current.LocalFolder);
        }
    }
    catch (Exception ex)
    {

        Debug.WriteLine(ex.Message);
    }
   
}

Upvotes: 1

Related Questions