As you may well be aware, I am in the last stages of completing an Add-In for importing .NET assemblies.
This basically trawls through the assemblies and extracts namespaces and creates packages accordingly.
As each namespace is encountered, I test to see if the package already exists using the following code:
//C#
try
{
testPackage = package.Packages.GetByName(packageName) as EA.Package;
}
catch (System.Runtime.InteropServices.COMException cex)
{
//Package does not exist, so create new one
newPackage = package.Packages.AddNew(packageName, "") as EA.Package;
newPackage.Update();
package.Update();
// etc.......
}
catch (Exception ex)
{
//Other Error Handling ....
}
I am sure this worked earlier, maybe under V3.5, but now, I keep getting a message box with the following message:
DAO.Database[3075]
Syntax error(missing operator) in query expression 'Name=myNameSpace' AND Package_ID in ()'
Does anyone have an idea as to what is happening? Am I dong something wrong? Otherwise, does anyone else have any ideas as to how to check for the pre-existence of a package?