Hi, Everyone
I am upgrading from AutoCAD 2008 to AutoCAD 2013. I have a project that was in VB.NET 2005 that I converted to VB.NET 2010 (Express). When I compile it, I get the following error:
Error 19 Reference required to assembly 'PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' containing the implemented interface 'System.Windows.Interop.IWin32Window'. Add one to your project.
The line causing the error is
ACApp.Application.MainWindow.Visible = False
The module imports the following:
Imports AC = Autodesk.AutoCAD
Imports ACApp = Autodesk.AutoCAD.ApplicationServices
Imports AcadDB = Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Runtime
I have tried changing the line to
ACApp.Core.Application.MainWindow.Visible = False
but that did not correct the error.
The .NET Migration Guide said that MainWindow was moved from Autodesk.AutoCAD.ApplicationServices.Application to Autodesk.AutoCAD.ApplicationServices.Core.Application, so as far as I know that change should have worked.
I feel like I must be missing something really obvious here, since I searched the discussion board and couldn't find anyone else asking about it. What am I missing?
Solved! Go to Solution.
Solved by chiefbraincloud. Go to Solution.
Did you watch the supplied video?
http://adndevblog.typepad.com/autocad/2012/05/extension-methods-in-autocad-2013.html
I don't know if this is covered in the video or not. I kind of doubt that it is, because it is not something new to 2013. It happened in at the latest 2012, maybe 2010, I don't remember. (I skipped 2011, and have not yet switched to 2013, and I had to deal with this already.)
It is very simple though, all you have to do is do what it tells you. Add a Reference to PresentationCore v4. This is not the same thing as Autodesk.AutoCAD.ApplicationServices.Core. It is also not your accessing of the MainWindow object that requires the change per se, it is something AuoCAD is doing under the hood, which accesses the iWin32Window interface, which creates a dependancy on PresentationCore.
chiefbraincloud, thank you for the answer and the explanation. I found PresentationCore.dll and added a reference to it.
I have read a number of your posts before when I was looking for answers.
GTVic, thanks for the links. The video on .NET migration was also helpful.