Вопрос

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.

Это было полезно?

Решение 3

Thanks for looking at this everyone, it turns out that the csproj file I was using had issues.

I created a brand new project (C# library) and just added a couple of files to it - marked them as Content and Always Copy and they landed in the drop folder.

It's a bit quick and dirty but I will add a post build event to delete the spurious dll, once I'm sure it's all working :)

Другие советы

Mark the file as resource and set as copy always.

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>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top