The XML method returns a read error
Because the CUI is the text file (XML format), but the CUIX file is an archive. You can't use the LINQ to XML for the CUIX. In your first message you wrote about the CUI. So I thought you use the old AutoCAD version.
It is strange: the mouse's right button click on the parent item ("ACAD" on the screen)
in the remote debug mode get the exception:
PInvokeStackImbalance occurred
Message: Помощник отладки управляемого кода "PInvokeStackImbalance" обнаружил неполадку в "C:\Program Files\Autodesk\AutoCAD 2014\acad.exe".
Additional information: A call to PInvoke function 'AcCustomize!Autodesk.AutoCAD.Customization.UserDataUtil::GetACADUserDataCacheLangPath' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
Without [remote?] debug mode an exception is not occur.
For AutoCAD 2014 I try it:
String extension = ".CUIX";
String menu_file = cad.GetSystemVariable("MENUNAME") + extension;
String menuGroupName = "ACAD";
String lispFileName = @"C:\Users\andrey\Desktop\file_1.lsp";
var csMain
= new Cst
.CustomizationSection(menu_file, menuGroupName,
false,
Cst.LspFileCollection lspFiles = csMain.MenuGroup.LspFiles;
lspFiles.Add(lispFileName);
Boolean result = csMain.Save(); // true
The "result" variable has the "true" value, but nothing happens. I don't know why. It is interesting for me too. Tell me, if you will find the decision. Maybe it is AutoCAD .NET API bug (I don't know).