Skip to content

Commit 1429dc4

Browse files
committed
Refactor project files to enhance package management and build quality settings
1 parent 161b97e commit 1429dc4

File tree

6 files changed

+133
-21
lines changed

6 files changed

+133
-21
lines changed
Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,72 @@
11
<!--
22
This file allows overriding of properties for all projects in the directory.
3-
See https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022#directorybuildprops-and-directorybuildtargets
3+
See
4+
https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022#directorybuildprops-and-directorybuildtargets
45
-->
56

67
<Project>
78
<ItemGroup>
89
<!-- Dotnet Watch to know about this file -->
9-
<Watch Include="$(MSBuildThisFileFullPath)"/>
10+
<Watch Include="$(MSBuildThisFileFullPath)" />
1011
</ItemGroup>
1112

13+
<!-- Package Info -->
14+
<!-- https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target -->
1215
<PropertyGroup>
1316
<PackageTags>f#, fsharp</PackageTags>
1417
<PackageProjectUrl>https://github.com/MyGithubUsername/MyLib.1</PackageProjectUrl>
15-
<PackageLicenseUrl>https://github.com/MyGithubUsername/MyLib.1/blob/master/LICENSE.md</PackageLicenseUrl>
1618
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
17-
<RepositoryType>git</RepositoryType>
19+
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
20+
<PackageReadmeFile>README.md</PackageReadmeFile> <!--https://docs.microsoft.com/en-gb/nuget/reference/msbuild-targets#packagereadmefile -->
1821
<Authors>MyGithubUsername</Authors>
22+
<RepositoryType>git</RepositoryType>
1923
<RepositoryUrl>https://github.com/MyGithubUsername/MyLib.1</RepositoryUrl>
2024
</PropertyGroup>
25+
26+
<!-- Build Quality -->
27+
<PropertyGroup>
28+
<!--
29+
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation#deterministic -->
30+
<Deterministic>true</Deterministic>
31+
<!--
32+
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#continuousintegrationbuild -->
33+
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
34+
<!--
35+
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/output#producereferenceassembly -->
36+
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
37+
<!--
38+
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#generatedocumentationfile -->
39+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
40+
41+
<!--
42+
https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/package-validation/overview -->
43+
<EnablePackageValidation>true</EnablePackageValidation>
44+
</PropertyGroup>
45+
46+
<!-- Code Quality -->
47+
<PropertyGroup>
48+
<!--
49+
https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/nullable-reference-types#create-the-application-and-enable-nullable-reference-types
50+
https://devblogs.microsoft.com/dotnet/nullable-reference-types-in-fsharp-9/#turning-the-feature-on -->
51+
<Nullable>enable</Nullable>
52+
<!--
53+
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings#treatwarningsaserrors -->
54+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
55+
<NoWarn>$(NoWarn)</NoWarn>
56+
</PropertyGroup>
57+
58+
<!-- Dependency Quality -->
59+
<PropertyGroup>
60+
<!-- Since this is a library, we should only care about direct vulnerabilities
61+
https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages#configuring-nuget-audit -->
62+
<NuGetAuditMode>all</NuGetAuditMode>
63+
<NuGetAuditLevel>low</NuGetAuditLevel>
64+
<NuGetAudit>true</NuGetAudit>
65+
</PropertyGroup>
66+
67+
2168
<PropertyGroup>
2269
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
2370
</PropertyGroup>
71+
2472
</Project>

Content/Console/Directory.Packages.props

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<ItemGroup>
44
<!-- Dotnet Watch to know about this file -->
5-
<Watch Include="$(MSBuildThisFileFullPath)"/>
5+
<Watch Include="$(MSBuildThisFileFullPath)" />
66
</ItemGroup>
77

88
<PropertyGroup>
@@ -15,14 +15,19 @@
1515
</PropertyGroup>
1616
<ItemGroup>
1717

18+
<!-- Main -->
1819
<PackageVersion Include="FSharp.Core" Version="8.0.403" />
20+
<PackageVersion Include="Argu" Version="6.0" />
21+
<PackageVersion Include="Packaging.Targets" Version="0.1.208" PrivateAssets="All" />
22+
23+
<!-- Tests -->
1924
<PackageVersion Include="Expecto" Version="10.2.2" />
2025
<PackageVersion Include="YoloDev.Expecto.TestSdk" Version="0.15.3" />
2126
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
22-
<PackageVersion Include="Packaging.Targets" Version="0.1.208" PrivateAssets="All" />
2327
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.0" PrivateAssets="All" />
2428
<PackageVersion Include="altcover" Version="8.2.825" />
2529

30+
<!-- Build -->
2631
<PackageVersion Include="Fake.IO.FileSystem" Version="$(FakeVersion)" />
2732
<PackageVersion Include="Fake.Core.Target" Version="$(FakeVersion)" />
2833
<PackageVersion Include="Fake.Core.ReleaseNotes" Version="$(FakeVersion)" />
@@ -34,6 +39,6 @@
3439
<PackageVersion Include="Fake.Api.GitHub" Version="$(FakeVersion)" />
3540
<PackageVersion Include="Fake.BuildServer.GitHubActions" Version="$(FakeVersion)" />
3641
<PackageVersion Include="MSBuild.StructuredLogger" Version="2.2.441" />
37-
<PackageVersion Include="Argu" Version="6.0" />
42+
<PackageVersion Include="System.Formats.Asn1" Version="6.0.1" />
3843
</ItemGroup>
3944
</Project>

Content/Console/build/build.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<PackageReference Include="Fake.BuildServer.GitHubActions" />
2525
<PackageReference Include="MSBuild.StructuredLogger" />
2626
<PackageReference Include="Argu" />
27+
<PackageReference Include="System.Formats.Asn1" />
2728
</ItemGroup>
2829

2930
</Project>
Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,77 @@
11

22
<!--
33
This file allows overriding of properties for all projects in the directory.
4-
See https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022#directorybuildprops-and-directorybuildtargets
4+
See
5+
https://learn.microsoft.com/en-us/visualstudio/msbuild/customize-by-directory?view=vs-2022#directorybuildprops-and-directorybuildtargets
56
-->
67

78
<Project>
89
<ItemGroup>
910
<!-- Dotnet Watch to know about this file -->
10-
<Watch Include="$(MSBuildThisFileFullPath)"/>
11+
<Watch Include="$(MSBuildThisFileFullPath)" />
1112
</ItemGroup>
1213

14+
<!-- Package Info -->
15+
<!-- https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target -->
1316
<PropertyGroup>
1417
<PackageTags>f#, fsharp</PackageTags>
1518
<PackageProjectUrl>https://github.com/MyGithubUsername/MyLib.1</PackageProjectUrl>
1619
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
1720
<PackageLicenseFile>LICENSE.md</PackageLicenseFile>
1821
<PackageReadmeFile>README.md</PackageReadmeFile> <!--https://docs.microsoft.com/en-gb/nuget/reference/msbuild-targets#packagereadmefile -->
19-
<RepositoryType>git</RepositoryType>
2022
<Authors>MyGithubUsername</Authors>
23+
<RepositoryType>git</RepositoryType>
2124
<RepositoryUrl>https://github.com/MyGithubUsername/MyLib.1</RepositoryUrl>
2225
</PropertyGroup>
26+
<ItemGroup>
27+
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="/" />
28+
<None Include="$(MSBuildThisFileDirectory)LICENSE.md" Pack="true" PackagePath="/" />
29+
</ItemGroup>
30+
31+
32+
<!-- Build Quality -->
33+
<PropertyGroup>
34+
<!--
35+
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/code-generation#deterministic -->
36+
<Deterministic>true</Deterministic>
37+
<!--
38+
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#continuousintegrationbuild -->
39+
<ContinuousIntegrationBuild Condition="'$(CI)' == 'true'">true</ContinuousIntegrationBuild>
40+
<!--
41+
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/output#producereferenceassembly -->
42+
<ProduceReferenceAssembly>true</ProduceReferenceAssembly>
43+
<!--
44+
https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#generatedocumentationfile -->
45+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
46+
47+
<!--
48+
https://learn.microsoft.com/en-us/dotnet/fundamentals/apicompat/package-validation/overview -->
49+
<EnablePackageValidation>true</EnablePackageValidation>
50+
</PropertyGroup>
51+
52+
<!-- Code Quality -->
53+
<PropertyGroup>
54+
<!--
55+
https://learn.microsoft.com/en-us/dotnet/csharp/tutorials/nullable-reference-types#create-the-application-and-enable-nullable-reference-types
56+
https://devblogs.microsoft.com/dotnet/nullable-reference-types-in-fsharp-9/#turning-the-feature-on -->
57+
<Nullable>enable</Nullable>
58+
<!--
59+
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-options/errors-warnings#treatwarningsaserrors -->
60+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
61+
<NoWarn>$(NoWarn)</NoWarn>
62+
</PropertyGroup>
63+
64+
<!-- Dependency Quality -->
65+
<PropertyGroup>
66+
<!-- Since this is a library, we should only care about direct vulnerabilities
67+
https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages-->
68+
<NuGetAuditMode>direct</NuGetAuditMode>
69+
<NuGetAuditLevel>low</NuGetAuditLevel>
70+
<NuGetAudit>true</NuGetAudit>
71+
</PropertyGroup>
72+
2373
<PropertyGroup>
2474
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
2575
</PropertyGroup>
26-
<ItemGroup>
27-
<None Include="$(MSBuildThisFileDirectory)README.md" Pack="true" PackagePath="/"/>
28-
<None Include="$(MSBuildThisFileDirectory)LICENSE.md" Pack="true" PackagePath="/"/>
29-
</ItemGroup>
76+
3077
</Project>

Content/Library/Directory.Packages.props

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Project>
33
<ItemGroup>
44
<!-- Dotnet Watch to know about this file -->
5-
<Watch Include="$(MSBuildThisFileFullPath)"/>
5+
<Watch Include="$(MSBuildThisFileFullPath)" />
66
</ItemGroup>
77

88
<PropertyGroup>
@@ -16,12 +16,18 @@
1616
<FakeVersion>6.1.3</FakeVersion>
1717
</PropertyGroup>
1818
<ItemGroup>
19+
20+
<!-- Main -->
1921
<PackageVersion Include="FSharp.Core" Version="8.0.403" />
2022
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.0" />
23+
24+
<!-- Tests -->
2125
<PackageVersion Include="altcover" Version="8.2.825" />
2226
<PackageVersion Include="Expecto" Version="10.2.2" />
2327
<PackageVersion Include="YoloDev.Expecto.TestSdk" Version="0.15.3" />
2428
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.13.0" />
29+
30+
<!-- Build -->
2531
<PackageVersion Include="Fake.IO.FileSystem" Version="$(FakeVersion)" />
2632
<PackageVersion Include="Fake.Core.Target" Version="$(FakeVersion)" />
2733
<PackageVersion Include="Fake.Core.ReleaseNotes" Version="$(FakeVersion)" />
Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
11
<Project>
22
<ItemGroup>
33
<!-- Dotnet Watch to know about this file -->
4-
<Watch Include="$(MSBuildThisFileFullPath)"/>
4+
<Watch Include="$(MSBuildThisFileFullPath)" />
55
</ItemGroup>
66

7-
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
7+
<Import
8+
Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
89
<PropertyGroup>
9-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
10+
<!-- Tell dotnet that anything under src should be packable -->
1011
<IsPackable>true</IsPackable>
12+
<!-- Tell dotnet that anything under src is not a test project -->
1113
<IsTestProject>false</IsTestProject>
12-
13-
<!-- Sourcelink -->
14+
</PropertyGroup>
15+
<PropertyGroup>
16+
<!-- Sourcelink
17+
https://devblogs.microsoft.com/dotnet/producing-packages-with-source-link/-->
1418
<PublishRepositoryUrl>true</PublishRepositoryUrl>
1519
<EmbedUntrackedSources>true</EmbedUntrackedSources>
16-
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
20+
<AllowedOutputExtensionsInPackageBuildOutputFolder>
21+
$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
1722
</PropertyGroup>
1823

1924
</Project>

0 commit comments

Comments
 (0)