.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

The type or namespace name 'PaletteSet' could not be found after migrating to .NET 8.0

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
r_nijkamp
255 Views, 2 Replies

The type or namespace name 'PaletteSet' could not be found after migrating to .NET 8.0

After running the Upgrade tool from Visual Studio 2022 my code for loading a usercontrol to a new toolpalette is failing.

I get the error The type or namespace name 'PaletteSet' could not be found (are you missing a using directive or an assembly reference?)

 

Before the upgrade the code was working fine and i had no error or missing reference.

According the developer docs, toolpalettes are part of Autodesk.AutoCAD.Windows 

When i add Using Autodesk.AutoCAD.Windows it gets greyed out and my code keeps the error.

 

Below a bare minimum project trying to load a palette. What am i missing?

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.Windows;
using System.Drawing;

namespace RN_ACADTOOLS
{
    public class MainClass
    {
        

        [CommandMethod("showmypalette")]
        public void ShowMyPalette()
        {
            createPallete();
        }


        public void createPallete()
        {

            string palleteName = "My-Palette";

            PaletteSet myPaletteSet = new PaletteSet(palleteName, new Guid("{E405F622-A37A-420C-BC18-16F0B1935A4A}"));

            myPaletteSet.Style = PaletteSetStyles.ShowAutoHideButton |
                                    PaletteSetStyles.ShowCloseButton |
                                    PaletteSetStyles.Snappable;

            myPaletteSet.Opacity = 100;

            myPaletteSet.Size = new Size(500, 400);
            myPaletteSet.MinimumSize = new Size(250, 200);

            myPaletteSet.Add(palleteName, new UCmain());
            myPaletteSet.Visible = true;
        }
    }
}

 

Labels (2)
2 REPLIES 2
Message 2 of 3
norman.yuan
in reply to: r_nijkamp

Have you added reference to acmgd.dll? Autodesk.AutoCAD.Windows.PaletteSet class is contained in acmdg.dll assembly.

 

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3
r_nijkamp
in reply to: norman.yuan

I feel stupid for missing this reference.
Thanks for your reply.

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

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report