Skip to content

Instantly share code, notes, and snippets.

@teyc
Forked from sheastrickland/DbUp.csproj
Last active August 29, 2015 14:23
Show Gist options
  • Save teyc/facaab93abb422dfd267 to your computer and use it in GitHub Desktop.
Save teyc/facaab93abb422dfd267 to your computer and use it in GitHub Desktop.
MSBuild convention checks
<Target Name="AfterBuild">
<Message Text="@(Content)" Importance="high" Condition="%(Content.Extension) == '.sql'" />
<Error Condition="%(Content.Extension) == '.sql'" Text="Nothing should be marked as Content, check your scripts are marked as Embedded Resource" />
</Target>
<Target Name="AfterBuild">
<!-- All files in Content directory should be marked Copy if Newer -->
<Error Condition="(%(None.CopyToOutputDirectory) != 'PreserveNewest' And %(Content.CopyToOutputDirectory) != 'PreserveNewest') And $([System.Text.RegularExpressions.Regex]::IsMatch('%(RelativeDir)', 'Content.+'))" Text="%(Identity) Items in Content directory must be marked Copy if Newer" />
</Target>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment