• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSX [C#] Can't compile with Runtime 4.0

JAB

Messages
19
Country
switzerland
Hello,

I recently switched from Delphi programming to C# using Visual Studio 2010 Express.

When trying to compile my first project, I get a "FileLoadException" on "Application.Run(new Form1));"

The message (in french) is : "L'assembly en mode mixte est créé avec la version 'v2.0.50727' du runtime et ne peut pas être chargé dans le runtime 4.0 sans d'autres informations de configuration."

I try to translate : "The assembly in mix mode (I suppose 'simconnect.dll') was created with version 'v2.0.50727' of the runtime and cannot be loaded into runtime 4.0 without other configuration data (informations)."

If I compile the same project using framework 3.5, it works fine ... but I want to use framework 4.0.

Question : Who knows which "configuration data" is missing and how I can add it ?

Thanks in advance
Jacky
 
Thanks Eusebiu,

I will try it at the next occasion (I was in holidays today, but tomorrow my job take over ...).

I will keep you informed, but probably not before next week-end.

A+
Jacky :)
 
Thanks Dick,

I always find your good answers when I am lost.
(do you remember when I was trying to use SimConnect with Delphi 7 ?)

I am not sure about Beatles' library : does it replace Simconnect 1:1 ?

To all ... sorry, I will probably not be able to try your suggestions before saturday ... heavy week at the office.

A+
Jacky :)
 
:banghead: Hello again,

I'm turning crazy !
Exhausted by those unsolved problems with VS2010/C# despite your advices,
I decided to turn to VS2008/C# hoping that things will match.

- Uninstalled SimConnect Client (installed previously by SimConnect.msi)
- Uninstalled all FSX SDK

- Installed FSX SDK (RTM)
- Installed fsx_sdk_sp1a.exe
- Installed SimConnect.msi (yes, version SP1 only, I want the users to be able to run my programs with SP1 only, but I have Acceleration installed)

- Verified in control panel : SimConnect Client v10.0.61242.0 is installed

- Defined a new project with C# 2008
- Added the reference "Microsoft.FlightSimulator.SimConnect" pointed to the "Microsoft.FlightSimulator.SimConnect" in the "...\managed folder" of the SDK (dated 10.05.2007 21:07, which seems to be SP1)

- Run my simple project with the accurate "using"'s
- Get an exception (translated from french) : "Unable to loadfile or assembly 'Microsoft.FlightSimulator.SimConnect, Version=10.0.61242.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of the dependencies. The file is not found."

... :banghead: :banghead: :banghead: :mad:
 
Hi Jacky.

tcalcx.png


You need to code:

Code:
using Microsoft.FlightSimulator.SimConnect;
using System.Runtime.InteropServices;

...but you also need to add a 'reference' to Microsoft.FlightSimulator.SimConnect

You add a reference by right-clicking on the References folder in Solution Explorer. In the picture, I circled the path of the reference in the properties window.

Code:
C:\WINDOWS\assembly\GAC_32\Microsoft.FlightSimulator.SimConnect\10.0.61259.0__31bf3856ad364e35\Microsoft.FlightSimulator.SimConnect.dll
on my computer.

The GAC is where the SxS dlls reside. I pointed to the SDK version 1, so the program is accessable to all versions of FSX.

The source for TCalcX can be found here:

TCalcX_Source

You should be able to load it into VisualStudio2008. It was originally made on VS2005Express, and it loads into VS2008Express OK after 'conversion'.

Dick
 
Hi again Dick,

Thanks for the picture and subtitles ;-) but :

Code:
using Microsoft.FlightSimulator.SimConnect;
using System.Runtime.InteropServices;

Of course already done !

...but you also need to add a 'reference' to Microsoft.FlightSimulator.SimConnect

Of course already done !

I get a bug somewhere, but where ? ... and my old Delphi 7 programs are still working along with SimConnect SP1 !

In Windows' side-by-side, I have all three versions of SimConnect :
- RTM : 10.0.60905.0 in folder C:\Windows\winsxs\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.60905.0_none_dd92b94d8a196297
- SP1 : 10.0.61355.0 in folder C:\Windows\winsxs\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.61242.0_none_e079b46b85043c20
- SP2-Xpack : 10.0.61637.0 in folder C:\Windows\winsxs\x86_microsoft.flightsimulator.simconnect_67c7c14424d61b5b_10.0.61259.0_none_55f5ecdc14f60568
all this with the corresponding .manifest and .cat files.
The "Microsoft.Flight Simulator.SimConnect.dll" file in the SDK core ... ... is version 10.0.61355.0 (FSX-SP1)

I will try to link the resource directly to the RTM version in WinSxS ... tomorrow ;-))

Thanks again.

A+
Jacky :o
 
Hi Jacky.

I did make a mistake. The GAC is where the .Net DLLs reside.

The program doesn't need to know where the correct Simconnect.dll is, as the .NET Dll will find it.

Dick
 
Hi Folks

Jacky -
From a quick post-pub-visit peek,
so I'm probably misunderstanding/talking rubbish here, :D
but it looks like you are mixing versions for SP1 and SP1a.

Installed SimConnect.msi
(yes, version SP1 only,
I want the users to be able to run my programs with SP1 only,
but I have Acceleration installed)

- Verified in control panel : SimConnect Client v10.0.61242.0 is installed
That's SP1.

- Added the reference "Microsoft.FlightSimulator.SimConnect" pointed to the "Microsoft.FlightSimulator.SimConnect" in the "...\managed folder" of the SDK (dated 10.05.2007 21:07, which seems to be SP1)
That's SP1a.
i.e. 10.0.61355.0 (fsx-sp1.20070510-2038)

all this with the corresponding .manifest and .cat files.
The "Microsoft.Flight Simulator.SimConnect.dll" file in the SDK core ... ... is version 10.0.61355.0 (FSX-SP1)
That's SP1a.


SDK SP1 == 10.0.61242.0 (SimConnect has matching #)
SDK SP1A == 10.0.61355.0 (SimConnect has matching #)



AIUI
SP1 SDK was superceded by SP1a.
i.e.
SP1 SDK was deprecated,
and SP1a SDK shoud be used to create content for SP1 game.



HTH
ATB
Paul
 
Last edited:
Hi Paul,

I think that you have put the finger right on the pain !

I will investigate but I am pretty sure that this confusion between SP1 and SP1a is the problem !

... but I never installed SDK SP1 on this computer ... I installed the DVD's SDK (RTM), then directly SDK SP1a ... strange ...

... please hold on ... ;)

A+
Jacky :eek:
 
Hi Folks

Jacky -
From your OP -
The message (in french) is : "L'assembly en mode mixte est créé avec la version 'v2.0.50727' du runtime et ne peut pas être chargé dans le runtime 4.0 sans d'autres informations de configuration."

I try to translate : "The assembly in mix mode (I suppose 'simconnect.dll') was created with version 'v2.0.50727' of the runtime
and cannot be loaded into runtime 4.0 without other configuration data (informations)."
Possibly an inability to utilise the v2.0.50727 VC80.CRT ?

Are you running a 64 bit OS ?
If so, have you forced the platform select win32/x86 binaries ?

HTH
ATB
Paul
 
Last edited:
Are you running a 64 bit OS ?
Yes I do. Win7 / 64

If so, have you forced the platform select win32/x86 binaries ?
No I didn't. I wouldn't even know how to achieve that (Visual Studio Express)

I am really tired with those problems.
By the way, it seems impossible to use unmanaged SimConnect with C#. Is that true ? Managed SimConnect is missing some functions.

A good news : Now my test with VS2010 suddenly works ! :banghead: I don't know why ...
For your information : here is what I am trying to do :

JABxApp.gif


Allows reorganization of aircract in categories
Edit all "text" aircraft data
Hide / display of selected aircraft in FSX choice panel
Pasting / zooming / cropping of a screen copy as thumbnail
Automatic selection of the FSX current plane (using the FSX button) (*)
Setting of the pilot's eye position (immediately visible in FSX) (*)
Installing new aircraft by simple drag-drop of zip files into FSX
Immadiately loading imported aircraft into FSX (*)
Removing aircraft with a simple clic
And so on ...

(*) = need SimConnect

A+
Jacky :cool:
 
Hi Folks

Yes I do. Win7 / 64


No I didn't. I wouldn't even know how to achieve that (Visual Studio Express)
Jacky -
Ok, win32/x86 targetting needs to be implemented..

Please see -
SDK - SimConnect - SimConnect Projects -
subsection titled - Setting x86 Platform Configuration
or -
How to: Optimize an Application for a Specific CPU Type

There's also info in this thread.

PS
That'll be a really useful tool for many simmers.

HTH
ATB
Paul
 
Hello Paul,
Ok, win32/x86 targetting needs to be implemented..
This option is not available in the Express edition (and I don't want to buy the prof version in order to compile freewares :cool:). But after investigating, the only mode allowed in Express versions is "X86", everything ok on that side.

A+
Jacky :D
 
Hi Folks

after investigating,
the only mode allowed in Express versions is "X86",
Jacky -
My apologies,
I hadn't previously realised Express was locked down to x86. :o

And re-reading your OP
you'd already mentioned your app worked in .NET 3.5
but fails on .NET 4.

With your .NET4 version,
if run in debug mode,
does it highlight where the issue occurs ?



Dick previously referenced Beatles post VS 2010 / .Net 4.0.
Have you added useLegacyV2RuntimeActivationPolicy="true" to the startup tag in the app.config ?



HTH
ATB
Paul
 
you'd already mentioned your app worked in .NET 3.5
but fails on .NET 4.
Yes BUT after several installs of several versions of SDKs & SimConnects, :
- It fails with VS2008 (.net 3.5)
- It runs now with VS2010 (.net 4.0) ! :rotfl:

With your .NET4 version, if run in debug mode, does it highlight where the issue occurs ?
Yes it does (VS2008) on the "Application.Run(new Form1);"

Have you added useLegacyV2RuntimeActivationPolicy="true" to the startup tag in the app.config ?
Yes I did.

I repeat : - It runs now with VS2010 (.net 4.0) ! :rotfl:

So basically, MY PROBLEM IS NOW SOLVED ... but very unsatisfying because I don't understand why it now runs, and why it didn't run previously.
.NET and SimConnect and WinSXS make me think about a gas plant built by manufacturers of sewing machines ... :eek:
Computing science is no more an exact science. It is perhaps even no more science at all :scratchch :wizard:

Thanks to everybody who tried to help me :wave:.
I will give you the link to download my program when ready, and I will build a english version ;) ... I have to find something about multilanguage support, probably with resources ...

A+
Jacky
 
Back
Top