Make a copy of the source project file in Explorer as CoreLib.vcxproj (in case other VS have checked the corresponding extension)
Add CoreLib.vcxproj as an existing project to your solution and save the solution.
Go to Properties-> Configuration Properties-> General from CoreLib .
Select all configurations (upper left corner).
Change the Configuration Type property to a static library .
Change the Target Extension property to .lib .
Add the Intermediate directory to the property, for example, \ Lib \ .
Go to Properties-> Configuration Properties-> C / C ++ β Preprocessor
Select Debug Configuration (upper left corner).
Now edit the Preprocessor Definition property and change the line _USRDLL to _USRLIB
Select Release Configuration (upper left corner).
Now edit the Preprocessor Definition property and change the line _USRDLL to _USRLIB
Your header file should have something like the following:
#ifdef MyDll_EXPORTS #define MyDll_API __declspec(dllexport) #else #define MyDll_API __declspec(dllimport) #endif
change it to the following:
#ifdef MyDll_EXPORTS #ifdef _USRLIB #define MyDll_API #else #define MyDll_API __declspec(dllexport) #endif #else
Now your assembly will generate your original dll and import the lib as well as the new static lib!
engf-010
source share