Solved

FME Objects in Visual Studio 2012

  • 9 August 2013
  • 1 reply
  • 4 views

Badge
Hello -

 

I've built applications using FME Objects in previous versions of Visual Studio, first back in VB6 then in VB.NET in VS 2005.  I'm now trying to use FME Objects again in C# within VS 2012 and am getting stuck.  Stuck at the very beginnging.

 

 

If I try to include this in a class library I get an FMEOException when it tries to create a session. The operative part of the code is below.

 

IFMEOSession m_pFMESession = null;

System.Collections.Specialized.StringCollection pSettings = new System.Collections.Specialized.StringCollection();

pSettings.Add("FME_DEBUG");

pSettings.Add("BADNEWS");

pSettings.Add("FME_USE_RICH_GEOMETRY");

pSettings.Add("yes");

m_pFMESession = FMEObject.CreateSession(); // Fails here

 

 

I've been told that FME Objects was built with an older version of the .NET library so I need to include an App.Config to reference the old runtime.   My App.Config looks like this:

 

 

<?xml version="1.0"?>

<configuration>

<startup useLegacyV2RuntimeActivationPolicy="true">

<supportedRuntime version="v2.0.50727"/></startup>

</configuration>

Still no luck though.   Is anyone using FME Objects in VS 2012?  Any information on how you've got it to work would be much appreciated.

 

 

 

Thanks,

 

Ed

 

 

 

 

 

 

 

 

 

 

 

 

icon

Best answer by e_blair 19 August 2013, 18:20

View original

1 reply

Badge
Phil from Safe Tech Support helped me solve this.  Basically I needed to change the "Platform Target" on the project "Build" tab from "Any CPU" to "x86".  After changing this parameter the reference to the FMEObjects library was  resolved and my code compiled.

 

 

There's a developer sample project in the install directory under \\fmeobjects\\samples that shows this as well.

 

 

Ed

 

 

 

 

 

Reply