Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Empty .net project just for copying files to output folder?

I have a large 'product' which is deployed as a set of zip files (separated into Web Apps, Web Services, Database, Tools, etc.).

I currently use MSBuild to collect files from VSS, build, zip and copy to a network share. I'm moving to TFS and while every other project type builds fine, I am trying to find a way to bring the database installation scripts out of source control and effectively just copy them to the drop location in their own folder (for zipping).

I've tried creating a solution file with an 'empty C# project' (with an assemblyInfo class to avoid the 'no source' warning) with all the scripts and supporting files marked as content and 'Copy always' but the files are just not appearing in the drop folder. The files do build locally exactly how I want but it doesn't work when built via TFS.

I'm wondering if there are any other ways of doing what I need - I am constrained in having the DB scripts as they are (i.e. no converting to an MSI). I've searched everywhere I can think of but drawn a blank!

TIA, Simes.

like image 350
Simes Avatar asked Jan 31 '26 11:01

Simes


2 Answers

Mark the file as resource and set as copy always.

like image 65
Tarun Arora Avatar answered Feb 02 '26 02:02

Tarun Arora


Have you considered writing your own msbuild project for this? You can then copy all files meeting your criteria to the $(outdir) folder.

Something along these lines should help:

<Project DefaultTargets="CopySqlScripts">
  <Target Name="CopySqlScripts">
    <ItemGroup>
      <SqlScripts Include="$(MSBuildProjectDirectory)\*.sql" />
    </ItemGroup>
    <Copy SourceFiles="@(SqlScripts)" DestinationFolder="$(OutDir)\SqlRelease" />
  </Target>
</Project>
like image 26
David Martin Avatar answered Feb 02 '26 01:02

David Martin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!