Have a DLL that runs fine in 2014, but when I run it in 2015 it breaks on the "RunCommand" method. Do I need to recompile it all with .NET 4.5, or is there a way to get it to work in both releases.
Module MyEditorExtensions Dim runCommand As MethodInfo = _ GetType(Editor).GetMethod("RunCommand", BindingFlags.Instance Or BindingFlags.NonPublic Or BindingFlags.Public) <System.Runtime.CompilerServices.Extension()> _ Public Function Command(ed As Editor, ParamArray args As Object()) As PromptStatus If Application.DocumentManager.IsApplicationContext Then Throw New InvalidOperationException("Invalid execution context for Command()") End If If ed.Document <> Application.DocumentManager.MdiActiveDocument Then Throw New InvalidOperationException("Document is not active") End If Return DirectCast(runCommand.Invoke(ed, New Object() {args}), PromptStatus) End Function End Module *********************************** Public Sub MultipleJoin() Dim db As Database = HostApplicationServices.WorkingDatabase Dim doc As Document = DocumentManager.MdiActiveDocument() Dim ed As Editor = DocumentManager.MdiActiveDocument.Editor ' Dim acEditor As Editor = Application.DocumentManager.MdiActiveDocument.Editor Dim peditAccept As Short = CShort(Application.GetSystemVariable("PEDITACCEPT")) Try Application.SetSystemVariable("PEDITACCEPT", 1) Dim typedValues() As TypedValue = {New TypedValue(8, "EX-CROSS-WELL-SCREEN"), New TypedValue(0, "ARC,LINE,LWPOLYLINE")} Dim sf As SelectionFilter = New SelectionFilter(typedValues) Dim psr As PromptSelectionResult = ed.SelectAll(sf) If psr.Status <> PromptStatus.OK Then Return End If ed.Command("_.pedit", "_multiple", psr.Value, "", "_join", 0.0, "") Catch ex As Autodesk.AutoCAD.Runtime.Exception MsgBox(ex.Message) Finally Application.SetSystemVariable("PEDITACCEPT", peditAccept) End Try End Sub
thanks for any input..
cj
Solved! Go to Solution.
Solved by _gile. Go to Solution.
Thanks Giles,
After a bit of fumbling around I got it over to a new project. I'm using VS2013 Express. Had a hard time getting it to go into Debug mode. I downloaded the .NET wizard, but they only have a C# one built, not a VB one.
Anyway, through some searching I got the .vbproj.user files modified and got it running.
Function is working fine again in 2015...THANKS!
Can't find what you're looking for? Ask the community or share your knowledge.