Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

.Net references for C3D 2012 project

13 REPLIES 13
Reply
Message 1 of 14
RasmusB
565 Views, 13 Replies

.Net references for C3D 2012 project

In my C3D 2012 .Net project, I reference the AecBaseMgd.dll from the Civil 3D 2012 installation folder. When I build the 32 bit version of this project, on my 64 bit machine, I get a warning saying that the AecBaseMgd.dll references a different platform. Do I need to copy this dll from the C3D 2012 installation folder on a 32 bit machine, to my computer for build purposes?

---
2B or not 2B? That is the question! The answer is FF.
13 REPLIES 13
Message 2 of 14
Jeff_M
in reply to: RasmusB

You shouldn't need to build separate 32/64 bit builds. I have projects built on my 64 bit machine that run fine on 32 bit installs. Just make sure the solution platform is set to AnyCPU.

Jeff_M, also a frequent Swamper
EESignature
Message 3 of 14
RasmusB
in reply to: RasmusB

Thanks for your answer. I also reference the AutoCAD interops dlls AutoCAD.Interop.dll and AutoCAD.Interop.Common.dll, which I have learned are different for 32 and 64 bit. Can I nonetheless have Platform Target set to Any CPU, and just build the project 2 times, once when I reference those interop dlls from the ObjectARX/inc-win32 folder and once when I reference the dlls from the ObjectARX/inc-x64 folder?
---
2B or not 2B? That is the question! The answer is FF.
Message 4 of 14
Jeff_M
in reply to: RasmusB

I just reference the Interops in the ObjectARX2012\inc-x64 folder and build. That same DLL will then also run on a 32 bit system.

Jeff_M, also a frequent Swamper
EESignature
Message 5 of 14
RasmusB
in reply to: RasmusB

Ok, thanks, I hope this will work for me as well, that would save me a lot of time. I guess you set the 'Embed Interop Types' property of the references to false?
---
2B or not 2B? That is the question! The answer is FF.
Message 6 of 14
Jeff_M
in reply to: RasmusB


@RasmusB wrote:
Ok, thanks, I hope this will work for me as well, that would save me a lot of time. I guess you set the 'Embed Interop Types' property of the references to false?

For 2012, yes. I'm still working on how to handle 2013....

Jeff_M, also a frequent Swamper
EESignature
Message 7 of 14
RasmusB
in reply to: RasmusB

Ok, I am already up and going on 2013, at least on 64 bit, have not tested 32 bit yet. The (few) differences are well described in the blogs Through the Interface and Civilized Development.
---
2B or not 2B? That is the question! The answer is FF.
Message 8 of 14
Jeff_M
in reply to: RasmusB

Yeah, I've got 2013x64 working fine as well. It's the 2013x86 that is giving me fits.

Jeff_M, also a frequent Swamper
EESignature
Message 9 of 14
RasmusB
in reply to: RasmusB

Maybe it's the AutoCAD interop dlls which have to be embedded and platform-specific 🙂 please feel free to add the problem and/or the solution to this thread...
---
2B or not 2B? That is the question! The answer is FF.
Message 10 of 14
RasmusB
in reply to: RasmusB

For each of the three references AeccXUiLand, AecXUIBase and AutoCAD.Interop, I get a compile warning saying that a reference to the embedded interop assembly stdole.dll (found in the GAC) was created, because each of them references stdole.dll indirectly. The warning suggests I should consider changing the Embed Interop Types property of the references (it is now set to False). Do you also get this build-warning?

---
2B or not 2B? That is the question! The answer is FF.
Message 11 of 14
Jeff_M
in reply to: RasmusB

For 2012, I just made sure all Interops were set to not be embedded, including the stdole.dll.

 

I've learned the for 2013 we must have separate builds for 32 & 64 bit versions. Not at all what I was hoping to hear. See info HERE

Jeff_M, also a frequent Swamper
EESignature
Message 12 of 14
RasmusB
in reply to: Jeff_M

If I build my 32 bit version as we have discussed, on my Win7x64, I get runtime errors on 32 bit machine, e.g.: Method not found: 'Int64 Autodesk.AECC.Interop.Land.IAeccTinSurface.get_ObjectID()'.

---
2B or not 2B? That is the question! The answer is FF.
Message 13 of 14
Jeff_M
in reply to: RasmusB

This is what I have done for my C3D2012 addon projects:

.NET 3.5, add the AutoCAD Interop references from the ObjectARX\inc-x64 folder, add the Aec* Interop references from the "Autodesk Shared\" and "Autodesk Shared\Civil Engineering 90" folders, all Interops set to NOT be embedded, all of the *mgd.dll's are referenced from the C3D install folder. The resulting dll can then be loaded in either 32 or 64 bit C3D and it works. There ARE a couple of Aecc objects that required special handling, creating Featurelines is one of these...here's what I've done to work around that:

                                                //AeccLandFeatureLine fline = site.FeatureLines.AddFromPolyline(acadObj.ObjectID, flStyle);
                                                //this fails when mixing 32/64 bit builds, use the following 5 lines of code instead
                                                object[] oArgs = new object[2];
                                                oArgs[0] = acadObj.GetType().InvokeMember("ObjectID", System.Reflection.BindingFlags.GetProperty, null, acadObj, null); 
                                                oArgs[1] = flStyle;
                                                AeccLandFeatureLines flines = site.FeatureLines;
                                                AeccLandFeatureLine fline = flines.GetType().InvokeMember("AddFromPolyline", System.Reflection.BindingFlags.InvokeMethod, null, flines, oArgs) as AeccLandFeatureLine;

 

For the C3D2013 projects it was much different. First, all Aec* interop dll files from each of the 32 & 64 bit installs were copied into the respective ObjectARX\inc-* folders. I setup my project to allow x64 & x86 builds, no AnyCPU option. I added the required references, with the interops pointing to the inc-x64 folder and set the Embedded option to True. I then built the project to insure that part built correctly. Next I closed the solution, opened the .csproj file in notepad and added this just before the first ItemGroup:

  <PropertyGroup Condition=" '$(Platform)' == 'x86' ">
    <InteropPath>C:\ObjectARX 2013\inc-win32</InteropPath>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Platform)' == 'x64' ">
    <InteropPath>C:\ObjectARX 2013\inc-x64</InteropPath>
  </PropertyGroup>

 Next I changed the Hintpaths for all of the Interops listed in the csproj file from "C:\Program Files\Autodesk\AutoCAD Civil 3D\*" & "C:\ObjectARX\inc-x64" to "$(InteropPath)\*". This makes it so the references auto change when switching between the x86 & x64 platforms. Make sure the build options Output paths are different for x64 & x86. Now the dll's created in their respective folders work in their intended environment.

 

I hope that helps! It took me hours to figure all that out. 

Jeff_M, also a frequent Swamper
EESignature
Message 14 of 14
RasmusB
in reply to: Jeff_M

Thank you so much for your replies! However, the 32 bit version, built on my 64 bit machine, fails during runtime even if I follow your "recipe". Also, with the changes on the 2013 version, I think I'll continue to build the two version on different machines.

---
2B or not 2B? That is the question! The answer is FF.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


Autodesk Design & Make Report