Prevent a project from building if a dependent project fails - visual-c++

I have a VS2010 solution that includes a custom project. The project builds an installer out of all the libraries and executables built in the same solution. This is a third-party installer builder, not a native Visual Studio installer project. It runs a custom command in the post-build event of the project.
The problem with this setup is that the installer project build runs (and succeeds!) even if some other project build fails.
I have added project dependencies so that the installer project depends on all other projects, to no avail. I have also tried to add project references with the same result.
This happens only with this specific project (probably because it's a custom project with configuration type "utility"). Other projects don't start building if a dependent project fails to build.
This is a dangerous situation. A developer may not pay attention to a build failure in some other project and use the incorrectly built installer. I need MSVC to skip building the installer project if some other project fails.
How should I deal with it?
Ideally this should be solved at the MSVC level. I don't want to add custom checks to the installer build command because this would mean I have to maintain a list of projects/targets in two separate places. I also don't want to introduce additional tools to the picture.

Related

Visual Studio builds njsproj Node.js project even though there are no changes since last build

I've added a Blank Node.js Web Application project to my solution. It is a *.njsproj the among of other C# *.csproj projects.
The project works fine. Visual Studio build runs npm run build according the package.json. There is only one thing bothering me. The *.njsproj is built everytime I build the solution.
Visual Studio can recognize when there is no change in the C# *.csproj projects and skips them saying they are up-to-date:
========== Build: 1 succeeded, 0 failed, 29 up-to-date, 0 skipped ==========
However, this does not work for the *.njsproj. The npm run build (raised from AfterCompile target in Microsoft.NodejsToolsV2.targets) is executed every single time even though there is absolutely no change in any of the solution projects or files at all.
Is Visual Studio even able to track changes of Node.js project to skip the build or there is no chance to make it work similar to the C# projects?
All the Node.js project files have Build Action set to None.
I think it is impossible. This is related to the VS IDE's internal build mechanism for Node JS projects of this type. And it is designed by that.
And I should tell you that the up-to-date check is a feature for VS IDE. You can try the VS IDE Build and MSBuild command line build msbuild xxx\xxx.csproj -t:build with the c# project, and you will find that:
IDE build will not execute any msbuild system target, and it detects that it should not build again since there is no changes to minimize the workload of MSBuild.
However, when you use msbuild command line, no matter there is no changes, it still invokes the many system default targets which will make a burden with a large solution.
So the up-to-date is a feature for VS IDE which will helps reduce the burden of msbuild.
We could only modify target one by one to skip by inputs, outputs. But this is meaningless since up-to-date is a new detection mechanism which is not dependent on MSBuild and Targets. There is no msbuild function to get the up-to-date under node js projects.
That is an internal mechanism We cannot handle that area, you need to contact the Microsoft product team by VS IDE menu-->Help-->Send Feedback-->Report a problem or that.

Sharing project in TFS

We are trying to figure a way to setup TFS for our needs. We have, let's say,
Project A, Project B and Framework, a project shared by many projects.
Framework
Project A
- Framework
Project B
- Framework
If the Framework is modified, we want to make sure that every project that
use it has the last version.
We first thought about sharing the Framework by adding it to project A and B using "Add as link"
in Visual Studio, but this would also modify all branches, which is not good. So we thought
about compiling Framework into a DLL and include a copy of this DLL into each project. The
drawback is that the DLL has to be updated manually for each project.
What is the best way to share a project in TFS?
There is no 'sharing' as such in TFS as-in the way you could with Visual SourceSafe. You have 3 options
Use branching and merging. You branch Framework into Project A and Project B. If changes are made to the framework, the project teams will have to merge them into their project. If they make changes to Framework in their project then they will have to merge back to Framework to allow other projects to consume the changes.
Use Workspace Mappings. Essentially this is setting up sharing. When I do a get on my ProjectA workspace, it would also get the code in Framework to a subdirectory that I can reference in ProjectA. Any changes would be propagated to Framework and all the projects as soon as they did a get latest.
And probably the best solution is to use something like nuget. Your Framework build would package and publish the latest version which would then be consumed by the Projects. You could choose to stick with a version or pull the latest at build time.
TFVC Gems - should cover the first 2 options
Dependency Management with NuGet.pdf - talks about option 3
I'm assuming that we're talking about a .NET set-up, if not then this might not be relevant.
I believe that if you have a reference to the framework project (rather than the compiled DLL), then every time you recompile your projects, you will pick up the latest version of Framework (obviously, this is dependant on your branching structure).
Another thing to consider, if the above doesn't work, is to use a build to recompile the dependencies first.

How can i tell visual studio to rebuild project when dependant library has been rebuilt

In my solution i have two projects.
One is a library that generates a .lib file on build.
The other is a test application using the library.
I have set the test project to be "dependent" on the library project.
However when i make changes to the library and press F5 to run the sample, it does not rebuild the sample. The dependency option only seem to make sure that the library is built when running the sample.
"On run,when projects are out of date" is set to "always build".
I'm using vs12.
you have set the Test project dependant on the Library but for this scenario you want that reversed.
Visual studio will not allow you to have a circular reference, so you will have to remove the project dependency for Test to Library and re-add it as Library to Test while you are working in this way.
The most common scenario would be a client app(Test) that is dependant on the Library and any changes on the Library would require a manual rebuild of the client, due to the fact the Library change may have broken signatures, types etc.

Visual Studio 2012 doesn't build C# project when C++ dependency changes

I have three projects in my solution: a C++ project called LibX, a C# project called LibX.NET which wraps LibX.dll using P/Invoke, and a C# WPF app called TestX.
LibX.NET is marked as dependent on LibX, and TestX copies LibX.dll to its output directory as part of a post-build step (since I can't think of a better way to ensure that TestX can use LibX.dll).
In VS2010, when I change a file in LibX and build, both LibX.NET and TestX are built, and so their post-build event fires and everything is made up-to-date.
However, in VS2012, when I change a file in LibX, VS doesn't build LibX.NET and TestX, claiming that they are "up-to-date". Is this a bug/regression in VS2012, or is it intentional? How do I get TestX to run its post-build step?
If you want changes in LibX to trigger builds in LibX.Net you need to reverse your project dependency between these two projects.
Since you have marked LibX.Net depends on LibX then you will need to compile LiX.Net to get both projects built. When you do that both projects will get compiled/skipped based on whether changes were made. And this is the same behavior in VS2010.

generate exe file

i have developed application in visual c++ 6.0,i have do exe of that application,i have done by using icnt.exe(install creator),but when i run my application exe file on other system which does't have the vc++ software it's showing dll files are missing,how could than i downloaded the dll files again it is asking other dll's files.i want run my application without installing vc++ software in windows,how can i solve it,plz help me i'm touble.
How to make Realease build? by default its debug build
thanks for reply.
As a wild guess, you have deployed the Debug build, which depends on DLLs that are not allowed to be shipped.
If that is the case, have VC6 create a Release build and deploy that.
You can verify which DLLs are required by your application with the depends.exe utility that came with Visual Studio.
Edit: The easiest way to get a release build when ready is to use the Batch Build command from the Build menu. It will let you pick among all of the known build types in the project, and choose to either build them clean (recommended) or to just bring them up to date.
It is also possible to switch the GUI to default to the Release build instead of Debug. That is the right thing to do if you actually need to run the debugger on the Release build. Note that both builds include debug symbols. The differences have more to do with which runtime libraries are linked, and certain optimizations such as making the assert() macro have no effect.

Resources