Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
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:

C++
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;
//-------------------------------------------------------------------------
Posted
Updated 8-Jan-23 2:26am
v2
Comments
[no name] 13-Nov-22 16:01pm    
You could use compiler directives.
#define p1
#if p1
..
#else
..
#endif

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