部署WPF项目后的XamlParseException [英] XamlParseException after deploying WPF project

查看:345
本文介绍了部署WPF项目后的XamlParseException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试部署我的WPF应用程序,我使用安装向导创建了一个安装项目。我添加的唯一项目输出是主要的。在构建并安装程序后,一旦我单击我的桌面上的exe,我得到一个弹出窗口,说我的程序已经停止工作,所以我点击调试程序,我看到

I have been trying to deploy my WPF app, I created a Setup Project using the Setup Wizard.The only Project Output I added was Primary. After building this and installing the program, as soon as i click the exe on my desktop i get a pop up that says "'My Program' has stopped working", so i click Debug the Program and i see


PresentationFramework.dll中出现类型为System.Windows.Markup.XamlParseException的未处理的异常。

An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll

附加信息:'set connectionId抛出异常'行号'10'和行位置'9'。

Additional information: 'Set connectionId threw an exception.' Line number '10' and line position '9'.

指出我要解决什么问题。我的应用程序中的任何地方没有'connectionId'。

This exception does not point me in any direction as to what to fix. there is no 'connectionId' anywhere in my app.

由于我的系统托盘的NotifyIcon,我曾经遇到过XAMLParseException,但这是通过添加图标来修复的到我的exe的路径。我认为这可能是问题,所以我添加了图标到我的安装项目,以及所有其他项目输出。仍然不工作。

I had previously ran into an XAMLParseException because of my NotifyIcon for my system tray, but this was fixed by adding the icon to the path of my exe. I thought this may be the problem so i added the icon to my Setup Project, along with all the other Project Outputs. Still Not Working.

我知道这是一个模糊的错误,但是任何帮助都不胜感激,我的应用程序根本不会运行。谢谢!

I know this is a vague error but any help at all would be appreciated, my app won't run at all. Thanks!

推荐答案

这通常是由于没有将所有依赖项复制到输出引起的。正如你所说错误消息不是很有帮助,但是我会检查你的应用程序是否有所有必要的依赖关系来解析已解析的类型。

This is normally caused by not having all dependencies copied to the output. As you say the error message is not very helpful, but I would check that your application has all the necessary dependencies available to resolve the parsed types.

通常这是足够的将Copy Local设置为引用的程序集,但是我遇到一些引用自身引用程序集的情况,因此可能需要明确地添加这些引用。

Normally it is enough to set Copy Local to true for referenced assemblies, but I've experienced some cases where references themselves reference assemblies, so it can be necessary to explicitly add those references as well.

更新:

@ BENN1TH重要添加

如果你想看到一个程序集是必要的:

一旦我发布和安装了我的项目(在调试VS2013桌面上工作正常,没有错误等),但是使用 http://geekswithblogs.net/lbugnion/archive/2007/03/14/108728.aspx 和wham!安装的项目正在工作..

Was getting the same type of issue once i had published and installed my project (was working fine in debug VS2013 Desktop, no errors etc) but used the advice in from http://geekswithblogs.net/lbugnion/archive/2007/03/14/108728.aspx and wham! installed project was working..

try

{
  InitializeComponent();
}
catch ( Exception ex )
{
  // Log error (including InnerExceptions!)
  // Handle exception
}

这篇关于部署WPF项目后的XamlParseException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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