Ryu
Ryu

Reputation: 8749

Make IDE build output binaries to single folder, and resolve ref's from it

Our build server has been using the following properties for some time

OutputPath=c:\output;
OutputDir=c:\output;
OutDir=c:\output;
ReferencePath=c:\output;
AdditionalLibPaths=c:\output

Which make all output go to a common folder, and also allow resolving references for that same folder. This works great because

  1. it's an optimization over building locally and copying references locally
  2. I need all my dll's in a common folder anyways so I can zip and ship

Since this is working great on the build box, I would like to bring the same experience to our developers. I want our IDE builds to behave the same way.

In other words, I want the work flows our developers always use (build solution, build project) to behave just like I described happens on the build box.

I could easily accomplish this if I asked the team to create an VS.Net external tool to a batch file that just calls msbuild on the selected project with the desired properties. But ideally they wouldn't have to change their workflow.

I want to know

Thanks

Upvotes: 2

Views: 323

Answers (2)

radical
radical

Reputation: 4424

You need the OutDir and ReferencePath both set, for the projects to send their output to OutDir and for them to resolve references from the same path. You could add a common targets file with:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
     <PropertyGroup>
           <OutDir>c:\output\</OutDir>
           <ReferencePath>$(OutDir);$(ReferencePath)</ReferencePath>
     </PropertyGroup>
</Project>

Put this in a foo.targets file, and import that in every project.

Upvotes: 1

Arnis Lapsa
Arnis Lapsa

Reputation: 47587

We are doing the same. Editing every csproj file. Quite a lot of plumbing but it works.

If possible - try to reduce count of assemblies to minimum.

Edits needed for Csproj:

  <ProjectReference Include="..\Core\Core.csproj">
      <Project>{9C81B684-40CC-472A-804D-7C0F963315F5}</Project>
      <Name>Core</Name>
    </ProjectReference>

Should become as regular reference:

<Reference Include="Core, Version=1.0.0.0, Culture=neutral,  
     processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\..\Deploy\$(Configuration)\Core.dll</HintPath>
    </Reference>

Although - relative path to deploy folder should be defined as property.

But i'm not a build guru. Just sharing some info. :)

Upvotes: 0

Related Questions