Customizing MSBuild

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm working on a big solution containing 12 projects. It takes hours (not
realy, but you get the picture) to build and i'm looking for ways to cut
corners and increase my "coding-not compiling time". To decrease build time,
I created a SlimBuild configuration which only buildt the most necessary
projects. This worked great in terms of build time, but as of now, its
worthless because the loader project does not copy the dll which are not
rebuild every time to the output folder of the loader project. The only dll's
which are updated are the ones which are set to be build when i do my
ctrl+shift+b. Sadly, it seems that the compiler does not check for newer
versions of dll's other than the ones that are set to be build every time. I
was wondering i there is a way to customize msbuild to manually copy all dlls
in the solution to the output directory of the loader project as a post-build
event?
 
Hi Mariusl,

You can use MSBuild's built-in COPY task to copy specific files from
your solution folders to the output directory.

In your case, the copy task implementation might look something like
this:

--------------BEGIN CODE-------------------
<ItemGroup>
<MySourceFiles Include="c:\MySolutionFolder\bin\*.dll"/>
</ItemGroup>

<Target Name="CopyFiles">
<Copy
SourceFiles="@(MySourceFiles)"

DestinationFiles="@(MySourceFiles->'c:\SolutionOutputDirectory\bin\%(Filename)%(Extension)')"
/>
</Target>
-----------------END CODE------------------

The above code has not been tested. Use it at your own risk.

You can find more information on the COPY Task at the following site:

http://msdn2.microsoft.com/en-us/library/3e54c37h.aspx

While working with MSBuild, I have compiled a list of MSBuild tutorials
and references here:

http://www.tod1d.net/blog/2005/12/msbuild-turorials-and-resources.html

Hope this helps.
 
Back
Top