安装ClickOnce发布的DPI感知应用程序 [英] Installing ClickOnce published DPI-aware application

查看:92
本文介绍了安装ClickOnce发布的DPI感知应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使我发疯的问题。

I have a problem that drives me mad.

我使用Visual Studio 2010 Professional。我以Microsoft在此处中显示的方式创建了可识别dpi的应用程序,通常是在包含以下内容的应用程序中添加清单:

I use visual studio 2010 professional. I create the dpi-aware application in the way that Microsoft showed here, which is in general adding a manifest to the application containing this:

<?xml version="1.0" encoding="utf-8"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
  <asmv3:application>
    <asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
      <dpiAware>true</dpiAware>
    </asmv3:windowsSettings>
  </asmv3:application>
</assembly>

然后我发布我的应用程序并尝试安装它。完全失败。在安装错误窗口中,弹出该应用程序格式不正确的信息(这是翻译版本,我使用波兰语版本的操作系统)。错误日志显示清单创建期间存在HRESULT 0x8007001f异常。此异常表示设备不起作用。很好,但是用什么设备呢?

Then I publish my application and I try to install it. Complete failure. During the installation error window pops out that the application is not properly formatted (this is a translation, I use Polish version of operating system). Error log shows that there was an HRESULT 0x8007001f exception during manifest creation. This exception means that "device is not functioning". Great but what device?.

Google研究表明,我遇到的这种错误可能与程序集的不正确签名有关。我花了几个小时试图解决这种问题,以各种方式对装配进行签名,但没有成功。

Google research suggested that that kind of error I've got may have something to do with the improperly signing of the assembly. I've spent several hours trying to solve this tying to sign the assembly in various ways without success.

我发现足以注释掉整个< windowsSettings> 标记,然后即使没有任何程序集签名,该应用程序也可以很好地安装。我想知道这是否与事实有关,当您在Web浏览器中的该标签的xmlns属性中键入该url时,服务器将响应在处理您的请求时发生错误。消息。

What I've found that it is enough to comment-out whole <windowsSettings> tag and then the application installs well, even without any assembly signing at all. I wonder if it has someting to do with the fact, that when you type that url in the xmlns attribute of that tag in the web browser then the server respons with the "An error occurred while processing your request." message.

有人可以帮忙吗?我已经在几台装有win7,win7 64和winxp的计算机上尝试过此方法,每次得到相同的结果时,我不知道为什么Google对此不显示任何内容。我是唯一尝试安装ClickOnce发布的dpi感知应用程序的人吗?

Can someone help? I've tried this on several machines with win7, win7 64 and winxp on them and each time i get the same result... I wonder why google doesn't show anything about this. Am I the only one who tries to install the ClickOnce published dpi-aware application?

推荐答案

只需从代码启用DPI感知。像这样的东西:

Just enable DPI aware from code. Something like this:

[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();

[STAThread]
static void Main()
{    
    if (Environment.OSVersion.Version.Major >= 6) SetProcessDPIAware();

    Application.EnableVisualStyles();
    Application.SetCompatibleTextRenderingDefault(false);
    ...

并删除app.manifest,应在发布后通过单击创建向导。

And remove app.manifest, it should be created by click once publish wizard.

这篇关于安装ClickOnce发布的DPI感知应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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