I have an MSBuild script that builds a class library to a DLL.
In order to build, I need to include references to several dlls (i.e. log4net.dll, Elmah.dll etc etc).
At the moment, my build file includes the path to each of the dlls like this:
<Reference Include="C:\Projects\MillinCommon\Trunk\bin\Debug\log4net.dll" />
<Reference Include="C:\Projects\MillinCommon\Trunk\bin\Debug\Elmah.dll" />
<Reference Include="C:\Projects\MillinCommon\Trunk\bin\Debug\Microsoft.Practices.EnterpriseLibrary.Common.dll" />
etc. etc. etc.
Then, in the Target, I have my CSC:
References=”@(Reference)”
This is becoming quite tedious. What I would like to do is put all dependent dll’s into a single directory someplace on the filesystem, and then pass a single to reference to the directory and MSBuild would use and required dll’s contained in that directory.
Is this possible?
To include all items from one folder, simply use a wildcard in your reference include statement:
You can even use recursive wildcards such as
C:\Projects\MillinCommon\Trunk\bin\**\*.dllto include from a folder and all its subfolders.See MSBuild Items – Using Wildcards to Specify Items for details.