I'm wondering if I'm instantiating a new class with the IGeoProcessor2 object correctly. It's working the way I have it now, but I feel like there's something else I should be doing so I don't have to turn "Embed Interop Types" in the Properties window to False. I'm working with ArcObjects 10.5, ArcGIS 10.5, and Visual Studio 2015.
This is the code I have to instantiate a new geoprocessing object:
IGeoProcessor2 gp = new GeoProcessorClass();
If I leave the Esri.ArcGIS.Geoprocessing assembly's "Embed Interop Types" property on "True", I get a squiggly red line under GeoProcessorClass. If I set it to "False", the squiggly goes away and everything works as expected. The same thing also happens with the ESRI.ArcGIS.System assembly when I use this code:
IVariantArray parameters = new VarArrayClass();
If I were to set the "Embed Interop Types" to false for the System assembly then the squiggly under VarArrayClass goes away and everything works great.
Is this something everyone has to do to get their code to work, or am I missing something that allows me to keep "Embed Interop Types" as "True"?
I am using IGeoProcessor2 instead of GeoProcessor because I am running a custom tool out of a custom toolbox, so I cannot switch to GeoProcessor. For whatever reason, I cannot get it to work with my code.