How do I run two projects in the desired order in visual studio?

Background:

I am working on two projects in visual studio 2015 - one that creates a file (I will call it " Generator ") and one that uses the specified file at runtime (I will call it Consumer ).

What I want to do:

I am currently working on a file generated by a Generator . To see how the Consumer is affected after changing the Generator , I have to:

  • Build and run the Generator ,
  • Run the startup project Consumer ,
  • Build and run Consumer ,
  • Transfer the startup project back to Generator .

I would like it all done in one Ctrl+ F5.

What I was trying to do:

There is a "Current selection" option in the properties → startup project which makes this tedious process a little faster, but this is only a partial solution.

I tried using "multiple startup projects" but this approach is not for me - it launches these projects at the same time and I want Consumer to wait until the Generator is done.

In my most successful approach, I created a .bat that launches the Generator and adds it to one of the Consumer build steps (it doesn't matter which step - I'm using the "prebuild event"). I also added a generator in Consumer Dependencies assembly. It works great when I change both the Generator and the Consumer . The problem comes when I only change the Generator - in this case, the Consumer assembly does not start at all - this means that my bat file will not run the Generator (I think the Consumer must be created because the dependent project has changed).

What I don't want to do:

My solution contains other projects, some of which are time consuming - I don't want to rebuild the whole solution or any of the other projects I mentioned.

The answer to this question is not for me - I don't want to change the Consumer just to simplify the construction process, because the Generator is just a utility for creating some file used in the main program ( Consumer ). On the other hand, I don't mind adding some additional projects.

Summarizing:

If you know how to make a project rebuild when it is deprecated, I would be happy. If you know of any other way to deal with my problem, I would be glad too.

+3


source to share


1 answer


I found "how have I not thought about this before?" kind of solution:



Since I want to run the Generator after modifying it, I really want to run it after the build. So instead of trying to run it in Consumer , I do it as a Post-Build Event Generator .

+1


source







All Articles