[DesktopBridge]运行时异常将WPF应用程序转换为“.APPX”后 [英] [DesktopBridge] Runtime Exceptions After convering WPF Application to ".APPX"

查看:45
本文介绍了[DesktopBridge]运行时异常将WPF应用程序转换为“.APPX”后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



(这实际上是多部分问题)

Hi,
(This is actually multi-part question)

使用DesktopBridge将小型WPF应用程序转换为.APPX。 现在,当我运行应用程序时,我看到代码抛出的异常在WPF中完美运行。 大多数情况下,这些异常是在读取文件或尝试执行
文件时引起的。

A small WPF application was converted to .APPX using DesktopBridge.  Now when I run the application I see exceptions being thrown from code which works perfectly in WPF.  Mostly these exceptions are caused while reading a file or trying to execute a file.

但是我不知道如何调试自安装的.appx应用程序。 但是我说哪些线路会造成麻烦。

However I don't know how to debug self-installed .appx application.  But I say which lines are causing trouble.

异常#1。我在下一行收到System.IO.DirectoryNotFoundException。

使用(StreamReader streamReader = new StreamReader(@"Terms \License.txt"",Encoding.UTF8) ))

using (StreamReader streamReader = new StreamReader(@"Terms\License.txt", Encoding.UTF8))

由于WPF应用程序运行良好,因此不太可能,但有人认为安装时可能没有复制License.txt文件。但有没有办法找出.appx App安装在哪个目录中?

Since as WPF application is works perfectly hence its less likely, but one thought was that perhaps file License.txt was not copied while installation. But is there a way to find out in which directory is the .appx App installed itself ?



异常#2。未知异常:目录名称无效。也许这个例外发生在下一行。

  ProcessStartInfo startInfo = new ProcessStartInfo(PathToJSEXE,jsFilePath + jsFileParameters);

  ProcessStartInfo startInfo = new ProcessStartInfo(PathToJSEXE, jsFilePath + jsFileParameters);

导致上述两个例外的原因是什么,什么是变通方法?

What is causing above two exceptions, Why and What is workaround ?

任何指针?

问候

推荐答案

您好Richard Freytag,

Hi Richard Freytag,

您需要将这些文件放在其他位置,例如本地应用程序数据存储。

You need to put these files in another location, like the local app data store.

这是因为当你的应用程序被转换时,一些路径将被重定向。例如,应用程序数据被重定向到本地应用程序数据存储。

It’s because when your app is converted, some paths will be redirected. For example, App data is redirected to the local app data store.

建议的模式是在安装包中包含模板文件,然后首先将它们复制到本地应用程序数据文件夹使用。请在此问题中查看Rob的回答: 

https://social.msdn.microsoft.com/Forums/windowsapps/en-US/284bfaec-392a-4775-864f-225543ca9b86/uwp-desktop-bridge-local-app-数据?论坛= wpdevelop

The recommended pattern is to include the template files in the install package and then copy them to the local app data folder on first use. Please see Rob's answer in this question:  https://social.msdn.microsoft.com/Forums/windowsapps/en-US/284bfaec-392a-4775-864f-225543ca9b86/uwp-desktop-bridge-local-app-data?forum=wpdevelop

最好的问候,

Xavier Eoro

Xavier Eoro


这篇关于[DesktopBridge]运行时异常将WPF应用程序转换为“.APPX”后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆