开发者

How to solve warning "Referenced assembly targets a different processor than the application"

开发者 https://www.devze.com 2023-01-07 06:32 出处:网络
I have been able to build my windows form application that access databases in SQL Server. All parts of the application are able to access the server apart from the part where one can back up/restore

I have been able to build my windows form application that access databases in SQL Server. All parts of the application are able to access the server apart from the part where one can back up/restore a database. In this part I can not access the databases on the server and have come to believe it is because of these warnings. What do the followings exactly mean and how can I correct them?

Referenced assembly
  'c:\Program 开发者_运维技巧Files\Microsoft SQLServer\90\SDK\Assemblies\Microsoft.SqlServer.Replication.dll' 
  targets a different processor than the application

Referenced assembly
  'C:\Windows\assembly\GAC_32\Microsoft.SqlServer.BatchParser\9.0.242.0_89845dcd8080cc91\Microsoft.SqlServer.BatchParser.dll'
  targets a different processor than the application.


it's been a year since you've asked this question.. but i just want to give the solution for this question...

if you using VS2010, go to your Project Properties, go to Compile, Advanced Compile Option, then set your target CPU to x86 or x64... cannot be both... choose one...

hope this solved.. :)


This is a bug with Visual Studio, it seems. Here's a more elaborate thread that explains some steps you can take to fix this.


Using Visual Studio 2010 I had to go to Project Properties -> Build Tab: Change "Platform target" from "Any CPU" to "x86"

This cleared up the warning message for me.

keywords: Referenced assembly targets a different processor than the application


Using Visual Studio 2010 I went to Main Menu --> Build --> Configuration Manager...

From there it's pretty obvious. Theres a big table. Each of your projects is a row. Look at the "platform" column. Change those entires to match each other.


This error can also occur after a Windows 10 update if certain DLLs that you're using have been deregistered somehow. This is now the third time this has happened - and it causes normally fine CPU settings to appear broken.

For me this keeps happening with Microsoft.mshtml - every major Windows 10 update!! - including the April 2018.

Quick steps:

  • Open developer command prompt for visual studio (as administrator)
  • Run gacutil /l | find "Microsoft.mshtml"
  • Go to the folder C:\Windows\assembly\GAC\Microsoft.mshtml
  • Run dir and change to the directory
  • Run regasm Microsoft.mshtml.dll
  • Try to compile again

http://techninotes.blogspot.com/2016/08/fixing-cannot-find-wrapper-assembly-for.html


In my case: Referenced assembly '####, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' targets a different processor.

In VS2017 - Build - "Prefer 32 Bit" was checked. Unchecked, csc error removed.

0

精彩评论

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