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

  • SEARCH
  • Home
  • 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 184899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T15:22:27+00:00 2026-05-11T15:22:27+00:00

My solution is primarily C#, but I have one C++ project that creates a

  • 0

My solution is primarily C#, but I have one C++ project that creates a DLL which my C# code calls. Here’s the layout:

[Edited: there are two levels of indirection, which causes the problem]

We’ll call the solution MySolution. It has four projects:

  MySolution     MyCppDll  (creates an unmanaged DLL)     MyCSharpWrapper (Managed wrapper for the unmanaged DLL)     MyCSharpLibrary (Contains classes that access the wrapper)     MyCSharpProgram (Creates classes from MyCSharpLibrary) 

I have the dependencies set up correctly so that MyCppDll is compiled first, then the wrapper, the library, and the program. However, when building within the IDE, the output of MyCppDll isn’t copied to the output directory of MyCSharpLibrary.

I can get around that problem by creating a post-build step for MyCSharpLibrary, making it copy MyCppDll.dll to the MyCSharpLibrary\bin\Debug (or \Release) directory.

But then when MyCSharpProgram is compiled, it gets the files associated with the wrapper and the library, but it doesn’t get the DLL. Again, I could create a post-build step to do it, but that’s less than ideal, for a couple of reasons.

The real solution has several dozen projects, many of which reference MyCSharpLibrary. Creating a post-build step for each one is, as you can imagine, tiresome and error-prone. And every time I add a new project that references that assembly, I’ll have to create another post-build step.

And it shouldn’t be necessary. When I build that solution from the command line, the DLL is copied from the MyCSharpLibrary directory as expected. That is, building from the IDE, the directory MyCSharpProgram\bin\Debug contains MyCSharpProgram.exe, MyCSharpLibrary.dll, MyCSharpWrapper.dll (plus the associated .pdb files). But if I build from the command line (using MSBuild), the directory contains all that AND MyCppDll.dll.

Has anybody else run into this problem? I’m using Visual Studio 2008 and haven’t yet upgraded to SP1.

[Edit – The problem appears to be that the files aren’t copied unless there is a direct reference from the Program project to the Wrapper project. That is, if I add a reference to MyCSharpWrapper in the MyCSharpProgram project, then the DLL is copied. Again, this only happens in the IDE. It works fine without that reference when building from the command line.]

  • 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. 2026-05-11T15:22:28+00:00Added an answer on May 11, 2026 at 3:22 pm

    We had issues with visual studio and mixed C++ and C# projects when using Build. Then we switched to only use Rebuild and it worked. You probably Rebuild from the command line and Build in the IDE.

    By the way, couldn’t it be that this reference needs to be there, because the project depends on it somehow?

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

Sidebar

Ask A Question

Stats

  • Questions 183k
  • Answers 183k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I fixed it with putting in a denormalized field in… May 12, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer This post from our beloved Scottgu might help you :) May 12, 2026 at 4:36 pm
  • Editorial Team
    Editorial Team added an answer I know you said PHP, you also mentioned your app… May 12, 2026 at 4:36 pm

Related Questions

I have a couple of solutions, but none of them work perfectly. Platform ASP.NET
I am in the design phase of writing a new Windows service application that
I have a question related to this one . I don't want to do
I have a windows setup project that installs a service. All works well except

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.