Page 1 of 1

Compiler warning in VS2017

Posted: Tue Apr 21, 2020 2:39 pm
by aivlasoft
Hello,

when compiling source code which is referencing SimConnect.dll (*1) from v5 SDK I'm getting the following compiler warning:
------------
2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\
Bin\Microsoft.Common.CurrentVersion.targets(2110,5):
warning MSB3270: There was a mismatch between the processor architecture of
the project being built "MSIL" and the processor architecture of the reference
"LockheedMartin.Prepar3D.SimConnect", "AMD64".
This mismatch may cause runtime failures. Please consider changing the targeted
processor architecture of your project through the Configuration Manager so as to align
the processor architectures between your project and references, or take a dependency
on references with a processor architecture that matches the targeted processor
architecture of your project.
------------

I guess that the fixed processor architecture AMD64 should be replaced by "any CPU"?

(*1)
C:\Program Files\Lockheed Martin\Prepar3D v5 SDK 5.0.21.34709\lib\SimConnect\managed\LockheedMartin.Prepar3D.SimConnect.dll

Re: Compiler warning in VS2017

Posted: Tue Apr 21, 2020 3:09 pm
by Highflyer525
Hi,

What this means is your project is set for either x86 or Any CPU whilst the SimConnect.dll is pure x64.

Go into your project, click compile on the left, and change your target CPU to x64. I think that’s it from memory.

You’ll also need to make sure your target framework under the application tab is .NET 4.8 for it all to play together nicely. From memory you might have to add that one using the bottom option in the framework drop down list for VS2017.

Cheers,

Mark.

P.S. sorry if I’ve misunderstood what you meant, you seem to already be experienced in programming according to your website.

Re: Compiler warning in VS2017

Posted: Tue Apr 21, 2020 3:14 pm
by Rob McCarthy
Hello,

We updated the core and SDK to Visual Studio 2019 for v5.

Regards,
Rob McCarthy

Re: Compiler warning in VS2017

Posted: Tue Apr 21, 2020 4:24 pm
by aivlasoft
Thanks Mark and Rob for your answer.

I never had to change the project settings in the past as long as the settings were set to "any CPU".
What I don't understand is not the "64" it's more the "AMD". So what about all the Intels out there?

Re: Compiler warning in VS2017

Posted: Tue Apr 21, 2020 7:04 pm
by Highflyer525
Hi,

Well the AMD part is a bit of a misnomer. From memory, the only reason x64 is sometimes referred to as AMD64 is because AMD actually invented the 64 bit instruction set and Intel adopted it at a later date.

AMD64 actually just means X64 and is the same for all processors.

Re: Compiler warning in VS2017

Posted: Wed Apr 22, 2020 9:03 am
by aivlasoft
Hi Mark,
thanks for clarification.

I tried to compile with x64 platform but now I'm getting the following warning:

3>------ Rebuild All started: Project: AivlaSoft.SimpleCam.Camera, Configuration: Release x64 ------
2>ALINK : warning AL1073: Referenced assembly 'mscorlib.dll' targets a different processor

So finally I have to learn that with this new SimConnect.dll either configuration/platform results in a warning. Kind of confusing ...

Re: Compiler warning in VS2017

Posted: Wed Apr 22, 2020 12:43 pm
by Highflyer525
That's an odd one, you got me on this.

Having a quick look around it looks like it might be related to a bug in VS2017. https://developercommunity.visualstudio ... assem.html

If you can, you should probably upgrade to VS2019 as Rob suggested, that's what I'm using as well. This should solve the issue, I haven't had it with the recent development I've just done with the latest Simconnect.dll.

Re: Compiler warning in VS2017

Posted: Fri Apr 24, 2020 12:48 pm
by aivlasoft
It's not only a bug in VS2017, it's obviously a bug from earlier versions already. I didn't get rid of it even after upgrading to VS2019 because the bug is still there and the warning comes up if the project contains localization satellite assemblies(.resx files). On 'Stackoverflow' some workarounds are provided.