开发者

ClickOnce Published WPF Application starts but fail to open a specific window

I am trying ClickOnce publishing service. I simply publish my solution to a share folder in online only mode, run the web page and my application starts.

I cick a button that open a 开发者_运维百科window fine, another one, fine too and then a third one and the window don't show up.

What I know:

It's not a missing DLL, there is no exception (exception logger) and it's working fine in Release/Debug

Do you have any hint/idea why this and how to hunt for the problem ?


You can add the file to your project and set the build action to "content" and "copy to output directory" to "copy always". Then, because it's an XML file, go into the Application Files dialog in the Publish tab and change the file from "Include(Data)" to "Include(Required)".

If you deploy it as data, it will put it in the DataDirectory instead of including it in the same folder as the main assemblies. Include(Data) is the default for XML files. (Annoying, isn't it?)


I use a file-based trace tool. I found out that there was a problem with an XML file. I found a blog post on MSDN that talks about that. I appear that the build action and the publish action ain't the same.

So the problem of the window was that it needed that XML file but didn't find it. It threw an exception but the exception logger didn't catch it because it was on another thread. (I then learned to foward exception to the main thread).

Finally, it seems you can't publish a file when it's from a DLL. It must be embedded to the DLL or moved to the main UI project (the published project).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜