【发布时间】:2019-06-25 22:16:41
【问题描述】:
我刚刚在 Visual Studio 中完成了我的 c# 应用程序。当我发布应用程序并尝试将其安装在我的机器和其他机器上时,我遇到了一个问题。在安装完成之前,我收到此错误:
以下是错误摘要,日志后面会列出这些错误的详细信息。
-
激活 C:\Users\JAP\Desktop\Ver\Diagnostics.application 导致异常。检测到以下失败消息:
- 清单中的引用与下载的程序集 LINQPad.exe 的标识不匹配。
三台机器上的相同错误(所有运行 windows 10 64 位)
以下代码是我使用 LINQPad 库的地方 (有很多案例) 我添加 LINQPad 的方式是添加对位于 (C:\Program Files (x86)\LINQPad5) 中的 .exe 的引用。
请注意,在 csproj 中它显示如下:
<Reference Include="LINQPad, Version=1.0.0.0, Culture=neutral, PublicKeyToken=21353812cd2a2db5, processorArchitecture=MSIL">
<SpecificVersion>True</SpecificVersion>
<HintPath>..\..\..\..\..\Program Files (x86)\LINQPad5\LINQPad.exe</HintPath>
</Reference>
我通过
调用引用using LINQPad;
我尝试过但都没有奏效的方法是:
1) 启用 ClickOnce 安全设置并选中完全信任应用程序
2) 创建不带清单和带清单的应用。
3) 未选中更喜欢 32 位
4) 启用优化代码和 DEBUG / TRACE 常量
5) 从 csproj 中删除引用
6) 清理、构建、重建
但似乎没有任何效果
private void gpuinfos(List<string> dataElements)
{
ManagementObjectSearcher mosgpu = new ManagementObjectSearcher("root\\CIMV2", $"SELECT {String.Join(",", dataElements)} FROM Win32_VideoController");
foreach (ManagementObject gpuInfo in mosgpu.Get())
{
foreach (var anElementName in dataElements)
{
string valuegpu Convert.ToString(gpuInfo[anElementName]);
valuegpu.Dump(anElementName);
switch (anElementName)
{
case "Name":
NameGPU.Text = valuegpu;
break;
...
}
}
}
}
More Error Details:
Following errors were detected during this operation.
* [6/26/2019 12:26:46 AM] System.Deployment.Application.InvalidDeploymentException (RefDefValidation)
- Reference in the manifest does not match the identity of the downloaded assembly LINQPad.exe.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.DownloadManager.ProcessDownloadedFile(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.DownloadModifiedEventHandler.Invoke(Object sender, DownloadEventArgs e)
at System.Deployment.Application.FileDownloader.OnModified()
at System.Deployment.Application.SystemNetDownloader.DownloadSingleFile(DownloadQueueItem next)
at System.Deployment.Application.SystemNetDownloader.DownloadAllFiles()
at System.Deployment.Application.FileDownloader.Download(SubscriptionState subState, X509Certificate2 clientCertificate)
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
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)
【问题讨论】: