Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3671948
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T02:32:58+00:00 2026-05-19T02:32:58+00:00

I have a number of native C++ libraries (Win32, without MFC) compiling under Visual

  • 0

I have a number of native C++ libraries (Win32, without MFC) compiling under Visual Studio 2005, and used in a number of solutions.

I’d like to be able to choose to compile and link them as either static libraries or DLLs, depending on the needs of the particular solution in which I’m using them.

What’s the best way to do this? I’ve considered these approaches:

1. Multiple project files

  • Example: “foo_static.vcproj” vs “foo_dll.vcproj”
  • Pro: easy to generate for new libraries, not too much manual vcproj munging.
  • Con: settings, file lists, etc. in two places get out of sync too easily.

2. Single project file, multiple configurations

  • Example: “Debug | Win32” vs “Debug DLL | Win32”, etc.
  • Pro: file lists are easier to keep in sync; compilation options are somewhat easier to keep in sync
  • Con: I build for both Win32 and Smart Device targets, so I already have multiple configurations; I don’t want to make my combinatorial explosion worse (“Static library for FooPhone | WinMobile 6”, “Dynamic library for FooPhone | WinMobile 6”, “Static library for BarPda | WinMobile 6”, etc.
  • Worse Con: VS 2005 has a bad habit of assuming that if you have a configuration defined for platform “Foo”, then you really need it for all other platforms in your solution, and haphazardly inserts all permutations of configuration/platform configurations all over the affected vcproj files, whether valid or not. (Bug filed with MS; closed as WONTFIX.)

3. Single project file, selecting static or dynamic via vsprops files

  • Example: store the appropriate vcproj fragments in property sheet files, then apply the “FooApp Static Library” property sheet to config/platform combinations when you want static libs, and apply the “FooApp DLL” property sheet when you want DLLs.
  • Pros: This is what I really want to do!
  • Cons: It doesn’t seem possible. It seems that the .vcproj attribute that switches between static and dynamic libraries (the ConfigurationType attribute of the Configuration element) isn’t overrideable by the .vsprops file. Microsoft’s published schema for these files lists only <Tool> and <UserMacro> elements.

EDIT: In case someone suggests it, I’ve also tried a more “clever” version of #3, in which I define a .vsprops containing a UserMacro called “ModuleConfigurationType” with a value of either “2” (DLL) or “4” (static library), and changed the configuration in the .vcproj to have ConfigurationType="$(ModuleConfigurationType)". Visual Studio silently and without warning removes the attribute and replaces it with ConfigurationType="1". So helpful!

Am I missing a better solution?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T02:32:58+00:00Added an answer on May 19, 2026 at 2:32 am

    I may have missed something, but why can’t you define the DLL project with no files, and just have it link the lib created by the other project?
    And, with respect to settings, you can factor them out in vsprop files…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of macros written for Visual Studio 2005, but they have
I have a C# program that uses a native C++ COM object. Visual Studio
i have a number of jsp files under web-inf folder. Inside my web.xml i
I have a native/unmanaged C++ library with a number of classes that I would
We're testing the native Visual Studio reporting technologies for ASP.NET (RDLC file + ReportViewer)
I'm working on a project were we have number (5 at the moment) of
I have a number of tracks recorded by a GPS, which more formally can
I have a number of application settings (in user scope) for my custom grid
I have a number of data classes representing various entities. Which is better: writing
I have a number of code value tables that contain a code and a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.