Skip to content

Instantly share code, notes, and snippets.

Created February 3, 2012 02:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstangroome/1727206 to your computer and use it in GitHub Desktop.
Save jstangroome/1727206 to your computer and use it in GitHub Desktop.
An auto-imported solution targets file to stop Team Build from overriding the OutDir property. Just put this file in your solution folder and rename 'TheSolution' to match the solution filename.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="">
<UsingTask Condition="'$(OutDir)' != ''"
AssemblyName="Microsoft.Build.Tasks.v4.0, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Projects ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="true" />
<BuildInParallel ParameterType="System.Boolean" />
<Properties ParameterType="System.String[]" />
<SkipNonexistentProjects ParameterType="System.String" />
<TargetOutputs ParameterType="Microsoft.Build.Framework.ITaskItem[]" Output="true" />
<Targets ParameterType="System.String[]" />
<Reference Include="Microsoft.Build.Tasks.v4.0, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<Code Type="Fragment" Language="cs">
var newProperties = new System.Collections.Generic.List<string>(Properties);
var childTask = new Microsoft.Build.Tasks.MSBuild();
childTask.BuildEngine = BuildEngine;
childTask.Projects = Projects;
childTask.BuildInParallel = BuildInParallel;
childTask.Properties = newProperties.ToArray();
childTask.SkipNonexistentProjects = SkipNonexistentProjects;
childTask.Targets = Targets;
childTask.RemoveProperties = "OutDir"; // Magic happens here!
var result = childTask.Execute();
TargetOutputs = childTask.TargetOutputs;
return result;
Copy link

mfuxi commented Apr 27, 2015

For most of my projects this solution works great, but I got one project which has build errors because of this addition to my solution directory.

The Error are like these for several projects: *****.csproj.metaproj: The project file could not be loaded. Could not find file ****.csproj.metaproj'.

Do u have any idea?


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment