System.Data processor architecture installed on AMD64

TFS issues the following warning:

C: \ Windows \ Microsoft.NET \ Framework64 \ v4.0.30319 \ Microsoft.Common.targets (1605): between the processor architecture the built project "MSIL" and the processor architecture Help "C: \ Windows \ Microsoft.NET \ Framework64 \ v4. 0.30319 \ System.Data.dll "," AMD64 ". This mismatch can lead to runtime failures. Please take note of the change in the target processor architecture of your project through the configuration manager to match the processor architectures between your project and the links, or to depend on the link with the processor architecture that matches the target processor architecture of your project.

Both “Release” and “Debug” configurations are configured to use “Any CPU” as the active solution platform.

I took a copy of System.Data.dll into the TEMP folder and extracted information about this assembly through PowerShell:

function ScanAssembly($assemblyPath) { [reflection.assemblyname]::GetAssemblyName($assemblyPath) } $assemblyPath = "C:\TEMP\System.Data.dll" $assemblyInfo = ScanAssembly($assemblyPath); $assemblyInfo | fl; 

I got the following output:

 Name : System.Data Version : 4.0.0.0 CultureInfo : CultureName : CodeBase : file:///C:/TEMP/System.Data.dll EscapedCodeBase : file:///C:/TEMP/System.Data.dll ProcessorArchitecture : Amd64 ContentType : Default Flags : PublicKey HashAlgorithm : SHA1 VersionCompatibility : SameMachine KeyPair : FullName : System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=... 

For some reason, ProcessorArchitecture is set to Amd64 for this assembly. I am confused why it is configured on Amd64 because I am running a 64-bit operating system on an Intel processor.

These warnings do not show traffic jams, but I'm struggling to understand why we see them. If I understand this correctly, the configuration is configured for any processor when one of the collections is compiled for Amd64, which means that it will no longer work on any CPU - it will only work on a 64-bit processor. Why System.Data.dll for Amd64 is built outside of me.

Thanks.

+4
source share
1 answer

You correctly know why these errors occur. If the referenced assembly is aimed at a specific structure, the compiler warns that your application cannot run on "any CPU" because the assembly reference has limitations.

We had this problem on our test and production servers with System.Data and other DLLs. We solved this by installing the SDK.Net Framework. For this:

  • Find the correct SDK. Our environments are configured on Windows Server 2008 and the .NET Framework 4.5, so we used the Windows 8 SDK .
  • Install only the .Net Framework 4.5 SDK (after accepting the license, there is a screen with several flags, I left only the last one).

The SDK adds a new version of System.Data.dll to C: \ Program Files (x86) \ Reference Assemblies \ Microsoft \ Framework \ .NETFramework \ v4.5. After examining this assembly, you will see that ProcessorArchitecture is set to None .

 Name : System.Data Version : 4.0.0.0 CultureInfo : CultureName : CodeBase : file:///C:/Program Files (x86)/Reference\Assemblies/Microsoft/Framework/.NETFramework/v4.5/System.Data.dll EscapedCodeBase : file:///C:/Program%20Files%20(x86)/Reference%20Assemblies/Microsoft/Framework/.NETFramework/v4.5/System.Data.dll ProcessorArchitecture : None ContentType : Default Flags : PublicKey HashAlgorithm : SHA1 VersionCompatibility : SameMachine KeyPair : FullName : System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 

Another option is to configure your project on target 64-bit processors, if this is an option, but our team has chosen the SDK route.

+7
source

Source: https://habr.com/ru/post/1497796/


All Articles