我刚刚在Visual Studio中完成了C#应用程序。发布应用程序并尝试将其安装在我的计算机以及其他计算机上时遇到了问题。在安装完成之前,我得到以下错误:
下面是错误的摘要,这些错误的详细信息在日志的后面列出。
激活C:\ Users \ JAP \ Desktop \ Ver \ Diagnostics.application导致异常。检测到以下失败消息:
三台计算机上的相同错误(所有运行Windows 10 64位)
以下代码是我使用LINQPad库的地方 (有很多情况) 我添加LINQPad的方法是添加对.exe的引用,该文件位于(C:\ Program Files(x86)\ LINQPad5)中。
请注意,在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)
答案 0 :(得分:1)
您似乎正在尝试从64位应用程序引用32位程序集。您将需要引用LINQPad的AnyCPU版本或LINQPad NuGet软件包。