dpiAware导致无效部署

时间:2018-02-24 11:27:25

标签: c# visual-studio

每当我从新的mannifest中取消注释以下内容时:

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
  <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>

并在发布时导致此错误。

[24/02/2018 10:23:54 PM] System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Exception reading manifest from file:///C:/Users/jorda/source/repos/Reminders/Reminders/publish/Application%20Files/Reminders_0_1_0_3/Reminders.exe.manifest: the manifest may not be valid or the file could not be opened.
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
            at System.Deployment.Application.DownloadManager.DownloadApplicationManifest(AssemblyManifest deploymentManifest, String targetDir, Uri deploymentUri, IDownloadNotification notification, DownloadOptions options, Uri& appSourceUri, String& appManifestPath)
            at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
            at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState& subState, ActivationDescription actDesc)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl, Uri& deploymentUri)
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
--- End of stack trace from previous location where exception was thrown ---
            at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
            at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivationWithRetry(Uri activationUri, Boolean isShortcut, String textualSubId, String deploymentProviderUrlFromExtension, BrowserSettings browserSettings, String& errorPageUrl)
            at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)
        --- Inner Exception ---
        System.Deployment.Application.InvalidDeploymentException (ManifestParse)
        - Parsing and DOM creation of the manifest resulted in error. Following parsing errors were noticed: 
            -HRESULT:   0x8007001f
             Start line:    0
             Start column:  0
             Host file:     
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Application.Manifest.AssemblyManifest.LoadCMSFromStream(Stream stream)
            at System.Deployment.Application.Manifest.AssemblyManifest..ctor(FileStream fileStream)
            at System.Deployment.Application.ManifestReader.FromDocument(String localPath, ManifestType manifestType, Uri sourceUri)
        --- Inner Exception ---
        System.Runtime.InteropServices.COMException
        - A device attached to the system is not functioning. (Exception from HRESULT: 0x8007001F)
        - Source: System.Deployment
        - Stack trace:
            at System.Deployment.Internal.Isolation.IsolationInterop.CreateCMSFromXml(Byte[] buffer, UInt32 bufferSize, IManifestParseErrorCallback Callback, Guid& riid)
            at System.Deployment.Application.Manifest.AssemblyManifest.LoadCMSFromStream(Stream stream)

实际上,只要能够测试清单就行了!它的工作完全没有意识到!它在调试和运行时非常有效。

我该如何解决?

编辑:好的。我没有DPI意识而陷入困境吗?

2 个答案:

答案 0 :(得分:0)

我在Visual Studio 2017和Visual Basic应用程序中遇到相同的问题。 它在刚刚更新的计算机上安装得很好(赢得10),但没有最新的更新安装失败。 通过转到项目属性,选择Windows选项来解决。在这里您可以注释掉dpiaware,从而引起问题。

答案 1 :(得分:0)

最近我也遇到了这个问题...几个小时后,这篇文章带给我一些可能是问题的指导。在app.manifest文件中注释此部分可以解决此问题。我的解决方案是使用WPF的Windows应用程序。

<application xmlns="urn:schemas-microsoft-com:asm.v3">
  <windowsSettings>
    <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
  </windowsSettings>
</application>