Click here to Skip to main content
15,799,398 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have 2 projects with same linked source code.

I gave similar dll same AliasName.

On each project switch, I have to swap the header in my cs-files.

What can I better do?

What I have tried:

extern alias AcMgdCore;
extern alias AcMgd;
extern alias AcMgdDb;
extern alias AcMgdDbBrep; 
// project 1
using AcMgdCore::Autodesk.AutoCAD.ApplicationServices;   //AcCore
using AcMgdDb::Autodesk.AutoCAD.DatabaseServices;        //AcDb
using AcMgdDb::Autodesk.AutoCAD.Geometry;                //AcDb
// project 2
using AcMgdCore::IntelliCAD.ApplicationServices;
using AcMgdDb::Teigha.DatabaseServices;
using AcMgdDb::Teigha.Geometry;
Updated 8-Jan-23 3:26am
Gerry Schmitz 13-Nov-22 16:01pm    
You could use compiler directives.
#define p1
#if p1

1 solution

I agree with Gerry that a Preprocessor Directive, such as #if ... would be the first choise.
Other options can be:

- Maybe create common header that will include all the necessary headers for both projects. This way, you only have to include a single header file in your cs files, regardless of which project you are working on.

- There are build systems such as CMake or GNU Make to automatically generate the header files based on the project being compiled. In such case, no need to manually include any headers in your cs files at all.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900