-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
85 lines (73 loc) · 3.61 KB
/
Directory.Build.props
File metadata and controls
85 lines (73 loc) · 3.61 KB
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
83
84
85
<Project>
<!-- Custom path definitions for repository structure -->
<PropertyGroup Label="Custom Repository Variables">
<RepositoryName>timewarp-source-generators</RepositoryName>
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
<SourceDirectory>$(RepositoryRoot)source/</SourceDirectory>
<TestsDirectory>$(RepositoryRoot)tests/</TestsDirectory>
<ArtifactsDirectory>$(RepositoryRoot)artifacts/</ArtifactsDirectory>
<PackagesDirectory>$(ArtifactsDirectory)packages/</PackagesDirectory>
</PropertyGroup>
<!-- MSBuild and NuGet behavior configuration -->
<PropertyGroup Label="MSBuild/NuGet Configuration">
<!-- Output packages to our local feed directory -->
<PackageOutputPath>$(PackagesDirectory)</PackageOutputPath>
<!-- Use local NuGet cache instead of global -->
<RestorePackagesPath>$(RepositoryRoot).nuget-cache/</RestorePackagesPath>
<!-- Suppress .NET preview SDK message -->
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
</PropertyGroup>
<!-- Default language and framework settings for all projects -->
<PropertyGroup Label="Project Defaults">
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<!-- Code quality, analyzers, and warning configuration -->
<PropertyGroup Label="Code Quality and Analysis">
<!-- Treat all warnings as errors -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn>CS7035;NU1503;1503;1591</NoWarn>
<!-- Enable compiler-generated files output -->
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<!-- Central Package Management -->
<PropertyGroup Label="NuGet Configuration">
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<!-- Source Link Settings -->
<PropertyGroup Label="Source Link Settings">
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>false</IncludeSymbols>
<DebugType>portable</DebugType>
</PropertyGroup>
<!-- Git commit metadata for assembly info -->
<Target Name="SetAssemblyMetaData" BeforeTargets="PreBuildEvent">
<Exec Command="git log -1 --format=%%ct" ConsoleToMSBuild="true" Condition="'$(OS)' == 'Windows_NT'">
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitTimestamp"/>
</Exec>
<Exec Command="git log -1 --format=%ct" ConsoleToMSBuild="true" Condition="'$(OS)' != 'Windows_NT'">
<Output TaskParameter="ConsoleOutput" PropertyName="GitCommitTimestamp"/>
</Exec>
<Exec Command="pwsh -ExecutionPolicy Bypass -NoProfile -File "$(MSBuildThisFileDirectory)convert-timestamp.ps1" -GitCommitTimestamp $(GitCommitTimestamp)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="CommitDate"/>
</Exec>
<ItemGroup>
<AssemblyAttribute Include="System.Reflection.AssemblyMetadataAttribute">
<_Parameter1>CommitDate</_Parameter1>
<_Parameter2>$(LastCommitDate)</_Parameter2>
</AssemblyAttribute>
</ItemGroup>
</Target>
<!-- Common analyzers for all projects -->
<ItemGroup Label="Code Analyzers">
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
</ItemGroup>
</Project>