views:

18

answers:

3

I've got a solution with dozens of projects. I can individually go into the nice "Properties" tab and change the output directories there, but that would take ages. What's the fast way?

Also, there are some old build configurations that are no longer required. How do I zap them?

A: 

there are some old build configurations that are no longer required. How do I zap them?

Some things can be done in Solution Properties | Configuration Manager

But largely you need to modify each individual project.

I can individually go into the nice "Properties" tab and change the output directories there, but that would take ages. What's the fast way?

  1. A macro?
  2. The project files (.csproj, .fsproj, ... depending on the underlying project type) are XML and can be edited inside VS (unload the project, then right click to directly edit the project file) or outside of VS.

The edits for #2 could themselves be automated.

How much automation you choose really depends on how many projects you have now, and whether you expect to need to make such a bulk change again.

Remember to keep plenty of backups, it is easy to break things.

Richard
A: 

to change common properties for all your projects at once, you could import a common project in all of them. Yes, this requires editing all your current projects (although it's not that hard to write a script listing all .csproj/... files recusrively and adding/removing a couple of lines), but if you have to make changes again in the future it will make things a lot easier.

For example, in all your projects use this (as last line before the end tag):

<Import Project="..\templates\mydefaults.targets/>

And in mydefaults.targets, for example:

<Import Project="mypaths.targets"/>
<PropertyGroup>
  <OutputPath>$(MyCommonBinDir)\(Configuration)$(PlatForm)\</OutputPath>
  <BaseIntermediateOutputPath>$(MyTempDir)\$(AssemblyName)\</BaseIntermediateOutputPath>
</PropertyGroup>

I like to keep the mypaths.target seperate: it defines MyCommonBinDir and MyTempDir, so if I want to build a branch of my original source tree I only have to change that file to set the output paths for all projects at once.

stijn
A: 

Right, I had a look around, and here's what I did:

Having nothing loaded, you can go to Edit > Replace in Files.

This allows you to search the solution directory for just .csproj files. I searched for the xml tag, and replaced it carefully with my new desired directory. Remember to do this for debug and release. Also, if you're in version control, make sure you don't screw up the base-copy files. (That's why you only search for .csproj).

Carlos