-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.targets
78 lines (64 loc) · 5.6 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
<Project>
<PropertyGroup>
<DirectoryBuildTargetsFilePathActual>$(MSBuildThisFileFullPath)</DirectoryBuildTargetsFilePathActual>
<IsTestProject Condition="$(MSBuildProjectName.EndsWith('.Test'))">true</IsTestProject>
<IsPrerelease>false</IsPrerelease>
<IsPrerelease Condition="$(Version.Contains('-'))">true</IsPrerelease>
<IsExecutable>false</IsExecutable>
<IsExecutable Condition="$(OutputType) == 'Exe' Or $(OutputType) == 'WinExe'">true</IsExecutable>
<IsLibrary>false</IsLibrary>
<IsLibrary Condition="$(OutputType) == 'Library' And !$(IsTestProject)">true</IsLibrary>
<IsPrimaryProject>false</IsPrimaryProject>
<IsPrimaryProject Condition="$(MSBuildProjectName) == $(PrimaryProjectName)">true</IsPrimaryProject>
<IsPublishable Condition="$(IsExecutable)">true</IsPublishable>
<IsPackable Condition="$(IsLibrary)">true</IsPackable>
<NoWarn Condition="$(IsTestProject)">$(NoWarn);CS1591;CA2225;IDE0022;IDE0058;CA1305;CA5394;</NoWarn>
<!-- CS1591: Missing XML comment for publicly visible type or member -->
<!-- CA2225: Operator overloads have named alternates -->
<!-- IDE0022: Use expression body for methods -->
<!-- IDE0058: Expression value is never used -->
<!-- CA1305: Specify IFormatProvider -->
<!-- CA5394: Do not use insecure randomness -->
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All"/>
<InternalsVisibleTo Condition="!$(IsTestProject)" Include="$(AssemblyName).Test" />
</ItemGroup>
<ItemGroup Condition="$(IsTestProject)">
<Using Include="Microsoft.VisualStudio.TestTools.UnitTesting" />
<ProjectReference Include="$(SolutionDir)\$(SolutionName)\$(SolutionName).csproj" />
<PackageReference Include="coverlet.collector" Version="6.0.4" />
<PackageReference Include="MSTest" Version="3.7.2" />
</ItemGroup>
<ItemGroup Condition="$(IsPrimaryProject)">
<!-- Build related files -->
<None Include="$(DirectoryBuildPropsFilePath)" Condition="Exists('$(DirectoryBuildPropsFilePath)')" Link="_Build\$(DirectoryBuildPropsFileName)" />
<None Include="$(DirectoryBuildTargetsFilePath)" Condition="Exists('$(DirectoryBuildTargetsFilePath)')" Link="_Build\$(DirectoryBuildTargetsFileName)" />
<None Include="$(GitHubWorkflowFilePath)" Condition="Exists('$(GitHubWorkflowFilePath)')" Link="_Build\$(GitHubWorkflowFileName)" />
<None Include="$(GitHubCopilotInstructionsFilePath)" Condition="Exists('$(GitHubCopilotInstructionsFilePath)')" Link="_Build\$(GitHubCopilotInstructionsFileName)" />
<None Include="$(EditorConfigFilePath)" Condition="Exists('$(EditorConfigFilePath)')" Link="_Build\$(EditorConfigFileName)" />
<None Include="$(RunSettingsFilePath)" Condition="Exists('$(RunSettingsFilePath)')" Link="_Build\$(RunSettingsFileName)" />
<!-- Git related files -->
<None Include="$(GitIgnoreFilePath)" Condition="Exists('$(GitIgnoreFilePath)')" Link="_Git\$(GitIgnoreFileName)" />
<None Include="$(GitAttributesFilePath)" Condition="Exists('$(GitAttributesFilePath)')" Link="_Git\$(GitAttributesFileName)" />
<None Include="$(GitConfigFilePath)" Condition="Exists('$(GitConfigFilePath)')" Link="_Git\$(GitConfigFileName)" />
<None Include="$(GitModulesFilePath)" Condition="Exists('$(GitModulesFilePath)')" Link="_Git\$(GitModulesFileName)" />
<None Include="$(GitMailMapFilePath)" Condition="Exists('$(GitMailMapFilePath)')" Link="_Git\$(GitMailMapFileName)" />
<!-- Package data files -->
<None Include="$(AuthorsFilePath)" Condition="Exists('$(AuthorsFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(AuthorsFileName)" />
<None Include="$(AuthorsUrlFilePath)" Condition="Exists('$(AuthorsUrlFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(AuthorsUrlFileName)" />
<None Include="$(ProjectUrlFilePath)" Condition="Exists('$(ProjectUrlFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(ProjectUrlFileName)" />
<None Include="$(DescriptionFilePath)" Condition="Exists('$(DescriptionFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(DescriptionFileName)" />
<None Include="$(LicenseFilePath)" Condition="Exists('$(LicenseFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(LicenseFileName)" />
<None Include="$(ChangelogFilePath)" Condition="Exists('$(ChangelogFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(ChangelogFileName)" />
<None Include="$(ReadmeFilePath)" Condition="Exists('$(ReadmeFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(ReadmeFileName)" />
<None Include="$(VersionFilePath)" Condition="Exists('$(VersionFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(VersionFileName)" />
<None Include="$(IconFilePath)" Condition="Exists('$(IconFilePath)')" Pack="true" PackagePath="\" Link="_PackageData\$(IconFileName)" />
</ItemGroup>
<Target Name="ValidateBuildFilePaths" BeforeTargets="BeforeBuild">
<Error Condition="!Exists('$(DirectoryBuildPropsFilePath)')" Text="Directory.Build.props file not found: $(DirectoryBuildPropsFilePath)" />
<Error Condition="!Exists('$(DirectoryBuildTargetsFilePath)')" Text="Directory.Build.targets file not found: $(DirectoryBuildTargetsFilePath)" />
<Error Condition="'$(DirectoryBuildPropsFilePath)' != '$(DirectoryBuildPropsFilePathActual)'" Text="Expected: $(DirectoryBuildPropsFilePath) Actual: $(DirectoryBuildPropsFilePathActual)" />
<Error Condition="'$(DirectoryBuildTargetsFilePath)' != '$(DirectoryBuildTargetsFilePathActual)'" Text="Expected: $(DirectoryBuildTargetsFilePath) Actual: $(DirectoryBuildTargetsFilePathActual)" />
</Target>
</Project>