Boise83716

I'm not sure if this is the correct forum for this question. If it isn't, please let me know what forum I should post to.


I have an unmanaged C++ application.
I have
ProjA => unmanaged c++ app (100s unmanaged .cpp files, 1 maanged cpp file)
ProjB => c#

ProjA depends on ProjB.

The C++ project calls C# classes from the C# project.

It all builds and runs just fine.

The problem is that ProjB is always built whenever I build ProjA.

So then the managed .cpp file in the C++ project then needs to relink - which is really really annoying. In this case, it's an additional 7-8 seconds just for this one file.

Is there anyway to prevent the C# project (ProjB) from recompiling each time I compile ProjA

thanks




Re: Visual C++ Language Preventing dependent projects from being built

Nishant Sivakumar

Perhaps it's a time stamp issue - happens sometimes when you move files across machines with mis-matching times (one of them may be incorrect).

Another thing is that if the C++ project has a project reference to the C# project, you probably don't need to doubly check it as a dependency.






Re: Visual C++ Language Preventing dependent projects from being built

crescens2k

Are you perhaps selecting Rebuild Solution That will delete all files and then recompile the whole thing. If you are then you should use Build Solution instead since this will just rebuild the outdated files.





Re: Visual C++ Language Preventing dependent projects from being built

Shakje

You can also just right click on the c++ project in the solution explorer and select build or rebuild to build just that project (eg if you wanted to rebuild the project without rebuilding the c# project).




Re: Visual C++ Language Preventing dependent projects from being built

Simple Samples

There might be a valid reason why VS thinks it needs to recompile when it does not; I know you know that and that you want to fix that if possible. Have you checked build rules Sometimes they don't get updated when needed so that VS tries to build something that never gets built.

If you can't solve the problem any other way, look in the Configuration Manager for the checkboxes that determine whether a project is built. You can stop builds for a project until you re-check the project's checkbox.






Re: Visual C++ Language Preventing dependent projects from being built

Boise83716

Turns out I was trying to solve the wrong problem.

My C# app was using a tlb file as a reference.

When ever I built the C++ app the C# would rerun tlbimp for its referenced .tlb file. This would put a new time stamp on the generated dll, this would cause the C# app to be rebuilt, and that would cause the C++ files that used the C# to be relinked. Messy.

So the lessons learned is don't add a reference to a .tlb file. Run tlbimp yourself.