Automatically build library - visual-studio-2013

I have a Visual Studio project which uses a library (both written in C). Often I make a change to the library as well as the project. Each time I make a change to the library I click on the build button then go back to the project and build that.
What I would like to do is specify something such that when I build my project it checks the library, finds that it needs to be built, build the library then continue to build my project.
Is there a way?

In Solution Explorer, right click on the solution. Select Properties then Project Dependencies. Use the dropdown under Projects and select the project you are building. That will bring up a list of all projects in the solution. Put a check mark on each project that depends on the project you are building. This assumes, of course, that your libraries are also projects in your solution.

Related

How to make one project build before all others?

I know you can set Build Dependencies for projects in Visual Studio and that will make the dependency build before the other projects. However, I have a project that all others will depend on (including new ones that may be added in the future), and so I'd rather just say "this project must build first, before all others" without bothering to set a dependency for every other project. Is there a way to do this in VS?
Is there a way to do this in VS?
Visual Studio calculates the build order according to your dependence. Like project A depends on project B, Visual Studio will build B prior to A. So if you want to make one project build before all others, you could not avoid this bothering setting or Visual Studio could not get the build order, will build in the error order.
In order to avoid set a dependency for every other project, you can right-click on your solution and find the Project Dependencies menu item:
The dialog that opens will allow you to set build dependencies and show you the calculated build order (you can affect the order by changing the dependencies).
In this case, you can set a dependency for every other project at once, no need to set for each one, but for new ones that may be added in the future, you still need to do the settings after added.

What is the correct way to manage module dependencies when using Prism?

I'm experimenting with Prism, and I've run into a number of inconveniences caused by the fact that the Shell project does not directly reference the Module projects. The primary inconvenience is that the modules output assembly and it's dependencies are not copied to the shell projects output folder after compilation. I've been successful in using xcopy as a post-build event to copy the target assembly to the projects output folder (which is not particularly nice, but seems to work), but not the dependencies.
Is there a standard way to solve this, or is it mostly ad-hoc solutions? Having to set a post-build event for every configuration in every module seems excessive, so I'd like to avoid it if possible.
There is a simple solution for this. You can set up project dependencies in Visual Studio without creating cross-references in the assemblies.
Open the solution properties and go to the Project Dependencies page. Here, select in the combo box Projects your main EXE that contains your shell. Alternatively, right click your main project in the Solution Explorer and select Project Dependencies... there:
In the Depends on listbox, check mark all your module projects that need to be compiled / copied in the output directory.
You can configure further dependencies for all your projects in the solution (e.g. if you have indirect dependencies between modules).
On changing any project that has dependencies, all dependent project will be rebuilt by Visual Studio and processed according the build configuration (e.g. copied to the output directory).

debugging dependent projects in visual studio

Sorry about the newbie question but I could not find an answer anywhere: I have a Visual Studio 2010 project (C#) with several dependencies on other projects in the same solution. When I debug the project and try to step into code in one of the dependencies, it steps over instead. Also, it seems that it is using a previous, installed version of the dependency instead of using the one in the solution.
How can I make it use the one in the solution and allow step-into?
Figured it out.
The dependencies' compiled versions were installed in the GAC - needed to take them out first.
Needed to turn on Tools->Options->Debugging->General->Enable Just My Code.
Needed to set Copy Local to True for each dependency in the target project.
Like everyone here pointed out, needed to re-build all dependencies first, in Debug mode.
Thanks everyone for your help!
When you add the projects as references, add them using the "projects" tab (of the "add references" dialog) instead of adding them as binary DLLs.
A project's output is only copied to the referencing project's bin folder if the dependent project is build. If the project is used in more than one solution, it may have been compiled previously but it won't update projects in the open solution. If the source is unchanged relative to the binary files, then the project is not compiled and the bin folder is not updated. Use Rebuild or Clean after opening the solution to ensure the projects are in sync.
Also check in Configuration Manager that all the projects have a Build checked.

run a project before main project in visual studio

I have a project that I use to convert an input text file to css.
I want to run this project every time I run my MVC project so it generates the newest css file.
I know that I can run a Task in BeforeBuild to achieve this, but it requires that I link to the dll file for my project. (This is a problem because if I use a dll file, then I would have to manually update the dll file
Is there a way I can build and run my first project, then launch MVC?
Right click the MVC project in the solution and select Project Dependencies, then check the project that you want to be built first
That will make sure that the dependency project builds first.
Then right click on Solution, select Properties and select Multiple startup projects in order to run two projects

Is there a way to have one project build another in Visual Studio?

We are finally getting a source control system in place at work and I've been in charge of setting it up. I've read that it's usually good practice to not include binaries in source control so I haven't. However, we have two all-purpose utility projects (each in their own solution) that generate utility .dll's which are included in almost all of our other projects (all each in their own separate solutions). We add references to the utility dll from our projects.
I would like to have our solutions set up in such a way that if the reference dll isn't built, the solution will build the dll for itself, much in the same way a make file checks for its dependencies and builds them when they're out of date or missing.
I'm new to build processes with VS so try to keep the answers simple. Any links to general build process overview tutorials would be great too. Googleing for VS references returns a bunch of how-to add references links which is not exactly what I want.
Answer: (3 step process) Add a project reference, not a binary reference by right clicking on the solution, and adding an existing project. Then under the project tab, select project dependencies and modify the project so that one project depends on another. Finally, delete any old reference to the binary and re-add the reference using the project tab in the Add references dialog box.
Where I work we typically have project references rather than binary references (as we used to a while ago). When you include a project reference, the dll will build along with the rest of your app.
The only time we go back to binary references is when we are in between Visual Studio releases (e.g. 1 project is in 2010 and everything else is in 2008. The 2010 project will have to use a binary reference for a couple of months until everyone else catches up... Project incompatibility seems to be a Visual Studio limitation that shouldn't exist).
EDIT
To add a project reference right click the solution and click Add and finally "Existing Project." Make sure that the utility projects are also under source control, and make sure that the workspaces are set up correctly or other people will not be able to open up the projects correctly!

Resources