-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.targets
82 lines (65 loc) · 3.38 KB
/
Directory.Build.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<Project>
<PropertyGroup>
<ArtifactsPath Condition=" '$(ArtifactsPath)' == '' ">$(BaseArtifactsPath)$(MSBuildProjectName)\</ArtifactsPath>
<CoreBuildDependsOn>$(CoreBuildDependsOn);_CheckVersion</CoreBuildDependsOn>
</PropertyGroup>
<PropertyGroup Condition=" '$(IsTestProject)' == 'true' Or '$(IsPackable)' == 'false' ">
<GenerateDocumentationFile>false</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup Condition=" '$(IsTestProject)' == 'true' Or '$(IsPackable)' == 'false' ">
<DocFileItem Remove="@(DocFileItem)" />
</ItemGroup>
<ItemGroup Condition=" '$(IsTestProject)' == 'true' ">
<PackageReference Include="coverlet.collector">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" />
<PackageReference Include="FluentAssertions.Analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<Using Include="FluentAssertions" />
<Using Include="Xunit" />
</ItemGroup>
<ItemGroup Condition=" '$(IsTestProject)' != 'true' ">
<InternalsVisibleTo Include="$(AssemblyName).Tests" />
</ItemGroup>
<ItemGroup Condition=" '$(IsPackable)' == 'true' ">
<PackageReference Include="Microsoft.Build.Artifacts" PrivateAssets="all"
IncludeAssets="build; buildtransitive; buildMultiTargeting" />
</ItemGroup>
<PropertyGroup Condition=" '$(ReadmePath)' == '' ">
<ReadmePath>$([MSBuild]::GetPathOfFileAbove('README.md', '$(MSBuildProjectDirectory)'))</ReadmePath>
</PropertyGroup>
<PropertyGroup Condition=" '$(ChangelogPath)' == '' ">
<ChangelogPath>$([MSBuild]::GetPathOfFileAbove('CHANGELOG.md', '$(MSBuildProjectDirectory)'))</ChangelogPath>
</PropertyGroup>
<ItemGroup Condition=" '$(IsPackable)' == 'true' And Exists('$(ReadmePath)') ">
<None Include="$(ReadmePath)" Pack="true" PackagePath="readme.md" />
</ItemGroup>
<ItemGroup Condition=" '$(IsPackable)' == 'true' And Exists('$(ChangelogPath)') ">
<None Include="$(ChangelogPath)" Pack="true" PackagePath="changelog.md" />
</ItemGroup>
<PropertyGroup Condition=" Exists('$(ReadmePath)') ">
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>
<PropertyGroup Condition=" Exists('$(ChangelogPath)') ">
<PackageReleaseNotes>$(IsPackable) $([System.IO.File]::ReadAllText("$(ChangelogPath)"))</PackageReleaseNotes>
</PropertyGroup>
<PropertyGroup Condition=" '$(VersionFilePath)' == '' ">
<VersionFilePath>$([MSBuild]::GetPathOfFileAbove('Version.props', '$(MSBuildProjectDirectory)'))</VersionFilePath>
</PropertyGroup>
<Import Project="$(VersionFilePath)" Condition="Exists('$(VersionFilePath)')" />
<Target Name="_CheckVersion">
<Error Condition="!Exists('$(VersionFilePath)')"
Text="Version file not found at '$(VersionFilePath)'" />
<Error Condition="'$(Version)' == ''" Text="Version not defined in '$(VersionFilePath)'" />
</Target>
</Project>