XamlParseException after deploying WPF project

2019-01-07 20:36发布

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

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

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

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

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!

10条回答
够拽才男人
2楼-- · 2019-01-07 21:09

I had this problem with a WPF solution in VS2010. The solution contained a simple dll and a test project (set to startup) for testing the dll. My dll was set to x86 and my test project was set to x64. When I changed the test project to x86 the problem was resolved.

查看更多
Deceive 欺骗
3楼-- · 2019-01-07 21:09

I just had a good 4 hours trying to figure this out. Mine ended up being nothing to do with the xaml! Turned out it was a minor error in the code behind on MainWindow initialize.

If all else fails, check there

查看更多
看我几分像从前
4楼-- · 2019-01-07 21:14

I solved this problem by removing Sign the assembly, here :

enter image description here

查看更多
贼婆χ
5楼-- · 2019-01-07 21:18

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
}
查看更多
女痞
6楼-- · 2019-01-07 21:21

I have got this problem. This problem occurs due to Microsoft.Expression.Drawing.dll please download dll and add reference.

查看更多
▲ chillily
7楼-- · 2019-01-07 21:23

I ran into this when working with multiple dlls running inside an application and those dlls have differing versions of the same dependency loaded.

We normally merge the dlls during our release build to prevent this issue, but we see it if we are testing more then one set of unmerged dlls during development cycle.

The solution it to only test one set of unmerged dlls, using merged release versions for the other dlls that are not being tested, or to ensure that the dependent dll is the same version for both sets.

查看更多
登录 后发表回答