-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDirectory.Build.props
241 lines (202 loc) · 13.9 KB
/
Directory.Build.props
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<Project >
<!-- Solution wide default location of the version file for all projects in the solution -->
<!-- Can be overridden if desired by a property of the same name in a project file for an assembly -->
<PropertyGroup>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<!-- Solution wide default location of the version file for all projects in the solution -->
<!-- Can be overridden if desired by a property of the same name in a project file for an assembly -->
<VersionFile Condition=" '$(VersionFile)' == '' ">$(MSBuildProjectDirectory)\properties\AssemblyInfo.cs</VersionFile>
<!-- Solution wide default location of the lock file for the UpdatePackageVersion tasks for all projects in the solution -->
<!-- Can be overridden if desired by a property of the same name in a project file for an assembly -->
<UpdatePackageVersionLockFilePath Condition=" '$(UpdatePackageVersionLockFilePath)' == '' ">$(MSBuildProjectDirectory)\$(MSBuildProjectName).UpdatePackageVersion.lock</UpdatePackageVersionLockFilePath>
</PropertyGroup>
<!-- The Build Configuration properties common for every assembly, can be overwritten in individual .csproj files -->
<PropertyGroup>
<Configurations>Debug;Release;ReleaseWithTrace;</Configurations>
<!-- When building against anything except net5.0 and higher, the c# V9 keyword 'init' throws errors. This is resolved in the AssemblyInfo.cs file for each project-->
<!-- when targetframework is netstandard,
<TargetFrameworks>net47;net471;net472;net48;netcoreapp3.1;net5.0;net6.0;net7.0<</TargetFrameworks>
-->
<TargetFrameworks>net7.0;</TargetFrameworks>
<RuntimeIdentifiers>win10-x64;linux-x64</RuntimeIdentifiers>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<!-- Enable Nullable Reference Type support solution-wide -->
<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>
<!-- solution-wide properties to include in every project -->
<PropertyGroup>
<!-- specify the root directory of the solution, relative to the location where the current project is found -->
<!-- when msbuild is run by Visual Studio 15.8.2, ($(MSBuildRuntimeType) != 'Core') the property $(SolutionDir) is already defined at this point, so this line is not executed -->
<!-- when msbuild is run by dotnet command, ($(MSBuildRuntimeType) == 'Core') the property $(SolutionDir) is not defined at this point, so this line is executed -->
<!-- ToDo: Major pain point, there is no way to know how far up SolutionDir may be. In this repository, code is (almost) always two subdirectories down from the solution dir -->
<!-- the result is that the $(SolutionDir) is set properly regardless of the $(MSBuildRuntimeType) -->
<SolutionDir >$(MSBuildProjectDirectory)\..\..\</SolutionDir>
<!-- Directory where all of the custom build tools are stored -->
<SolutionBuildToolsBaseDir Condition=" '$(SolutionBuildToolsBaseDir)' == '' ">$(SolutionDir)Build\</SolutionBuildToolsBaseDir>
<!-- bring in the build tasks extensions defined in the MSBuild.Community project-->
<MSBuildCommunityTasksPath Condition=" '$(MSBuildCommunityTasksPath)' == '' ">$(SolutionBuildToolsBaseDir)MSBuildTasks.*\build</MSBuildCommunityTasksPath>
<!-- bring in the build tasks extensions defined in the ATAP.Utilities.BuildTooling project-->
<!-- ATAPBuildToolingConfiguration is normally set to Release; use Debug if developing the BuildTooling assemblies and scripts -->
<ATAPBuildToolingConfiguration>Debug</ATAPBuildToolingConfiguration>
<ATAPBuildToolingRelativeBasePath>ATAP.Utilities.BuildTooling.0.1.0.1\build\</ATAPBuildToolingRelativeBasePath>
<!-- ATAPBuildToolingDebugVerbosity controls the level of details the Debug mode logging. If ATAPBuildToolingConfiguration is not Debug, this setting has no effect -->
<!-- valid values for ATAPBuildToolingDebugVerbosity are trace -->
<ATAPBuildToolingDebugVerbosity>Trace</ATAPBuildToolingDebugVerbosity>
<ATAPUtilitiesBuildToolingTargetsPath>$(SolutionBuildToolsBaseDir)$(ATAPBuildToolingRelativeBasePath)</ATAPUtilitiesBuildToolingTargetsPath>
<ATAPUtilitiesBuildToolingTasksPath>$(SolutionBuildToolsBaseDir)$(ATAPBuildToolingRelativeBasePath)</ATAPUtilitiesBuildToolingTasksPath>
<ATAPUtilitiesBuildToolingTasksAssembly Condition=" '$(MSBuildRuntimeType)' == 'Core'">$(ATAPUtilitiesBuildToolingTasksPath)\Release\net5.0\ATAP.Utilities.BuildTooling.CSharp.dll</ATAPUtilitiesBuildToolingTasksAssembly>
<ATAPUtilitiesBuildToolingTasksAssembly Condition=" '$(MSBuildRuntimeType)' != 'Core'">$(ATAPUtilitiesBuildToolingTasksPath)\Release\net471\ATAP.Utilities.BuildTooling.CSharp.dll</ATAPUtilitiesBuildToolingTasksAssembly>
<!-- The Roslyn Code Analyzers for FxCop Rules should be installed as a Nuget Package at the Solution level, per this article https://docs.microsoft.com/en-us/visualstudio/code-quality/install-fxcop-analyzers?view=vs-2019 -->
<!-- Per this article https://docs.microsoft.com/en-us/visualstudio/code-quality/roslyn-analyzers-overview?view=vs-2019#nuget-package-versus-vsix-extension the legacy post-build code analysis tools should be turned off -->
<RunCodeAnalysis>false</RunCodeAnalysis>
<!-- Enable or disable MSBuild's Binary Build Log for all projects in the solution -->
<binaryLogger>
<LogFile>msbuild.binlog</LogFile>
</binaryLogger>
<!-- Enable or disable MSBuild's file-based Build Log for all projects in the solution -->
<fileLogger>
<LogFile>msbuild.log</LogFile>
</fileLogger>
</PropertyGroup>
<!-- NuGet Package information for all assemblies in the solution -->
<PropertyGroup>
<Company></Company>
<Copyright>William Hertzing</Copyright>
<Authors>William Hertzing</Authors>
<Product>ATAP.Utilities</Product>
<ProductName>ATAP.Utilities</ProductName>
<RepositoryUrl>https://github.com/BillHertzing/ATAP.Utilities</RepositoryUrl>
<RepositoryType>GitHub</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageProjectUrl>www.project.url</PackageProjectUrl>
<PackageIconUrl>www.icon.url</PackageIconUrl>
<PackageTags>Testing, experimental, alpha, ATAP, ATAP.Utilities</PackageTags>
<PackageReleaseNotes>Initial implementation/test of ATAP.Utilities Nuget packaging</PackageReleaseNotes>
</PropertyGroup>
<!-- NuGet Local Feed location, using an environment variable and fallback -->
<PropertyGroup>
<NuGetLocalFeedPath Condition=" '$(NuGetLocalFeedPath)' == '' ">C:\Dropbox\NuGetLocalFeed</NuGetLocalFeedPath>
</PropertyGroup>
<!-- To support Microsoft Source Link, allow .pdf files in the generated NuGet package -->
<!-- To support Microsoft Source Link, allow Untracked sources (generated .cs files) in the generated NuGet package -->
<PropertyGroup>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>
<!-- Do not allow the compiler to generate Binding Redirects -->
<PropertyGroup>
<AutoGenerateBindingRedirects Condition=" '$(AutoGenerateBindingRedirects)' == '' ">false</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType Condition=" '$(GenerateBindingRedirectsOutputType)' == '' ">true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
<!-- Define the maximum number of CPUs to use when building in parallel. value of 1 indicates to not build anything in parallel, and makes reading the build log linear -->
<PropertyGroup>
<maxcpucount>1</maxcpucount>
</PropertyGroup>
<!-- Set MSBuild output verbosity and warnings to ignore. The disabled warnings are regarding the nullable reference types, until I can figure out the correct way to use them along with the 'default' argument specification -->
<!-- Attribution: https://github.com/lecaillon/Evolve/blob/master/src/Evolve/Evolve.csproj has a working example to silence many nullability warnings, but similar does not work for NuGet package warnings -->
<PropertyGroup>
<NoWarn>$(NoWarn);8600;8601;8602;8603;8604;8605;8618;8625;8629</NoWarn>
</PropertyGroup>
<!-- Attribution: many posts about this on the internet, nobody seems to have solved the problem. At least, my attempts using the following flags fails -->
<!-- disable the nullable warnings when compiling
<PropertyGroup Condition="'$(TargetFramework)' == 'net35' OR '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net5.0'">
<NoWarn>$(NoWarn);8600;8601;8602;8603;8604</NoWarn>
<Warninglevel>0</Warninglevel>
<clp>NoSummary</clp>
<clp>ErrorsOnly</clp>
<clp>NoItemAndPropertyList</clp>
</PropertyGroup>
-->
<!-- Release Configuration compilation symbols, flags and build options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);RELEASE;</DefineConstants>
</PropertyGroup>
<!-- ReleaseWithTrace Configuration compilation symbols, flags and build options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseWithTrace|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DefineConstants>$(DefineConstants);RELEASE;TRACE;</DefineConstants>
</PropertyGroup>
<!-- Debug Configuration compilation symbols, flags and build options -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<!-- Using Fody for methodBoundryAspect messes up debugging symbols https://github.com/vescon/MethodBoundaryAspect.Fody/issues/71 -->
<!-- <DefineConstants>DEBUG;TRACE;</DefineConstants> -->
<DefineConstants>$(DefineConstants);DEBUG;</DefineConstants>
</PropertyGroup>
<!-- Any Core TargetFramework -->
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(TargetFramework), '^(core|net[56])'))">
<DefineConstants>$(DefineConstants);NETCORE</DefineConstants>
</PropertyGroup>
<!-- Any Desktop TargetFramework -->
<PropertyGroup Condition="$([System.Text.RegularExpressions.Regex]::IsMatch($(TargetFramework), '^net4'))">
<DefineConstants>$(DefineConstants);NETDESKTOP</DefineConstants>
</PropertyGroup>
<!-- .NET Standard any version references, compilation flags and build options -->
<PropertyGroup Condition="$(TargetFramework.Contains('standard'))">
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
</PropertyGroup>
<!-- .NET Standard 2.0 references, compilation flags and build options -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<DefineConstants>$(DefineConstants);NETSTANDARD2_0</DefineConstants>
</PropertyGroup>
<!-- .NET Standard 2.1 references, compilation flags and build options -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<DefineConstants>$(DefineConstants);NETSTANDARD2_1</DefineConstants>
</PropertyGroup>
<!-- .NET Core 2.0 references, compilation flags and build options -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<DefineConstants>$(DefineConstants);NETCOREAPP2_0</DefineConstants>
</PropertyGroup>
<!-- .NET Core 2.1 references, compilation flags and build options -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<DefineConstants>$(DefineConstants);NETCOREAPP2_1</DefineConstants>
</PropertyGroup>
<!-- .NET Core 3.0 references, compilation flags and build options -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.0'">
<DefineConstants>$(DefineConstants);NETCOREAPP3_0</DefineConstants>
</PropertyGroup>
<!-- .NET Core 3.1 references, compilation flags and build options -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<DefineConstants>$(DefineConstants);NETCOREAPP3_1</DefineConstants>
</PropertyGroup>
<!-- .NET 45 references, compilation flags and build options -->
<PropertyGroup Condition="$(TargetFramework.Contains('net45'))">
<DefineConstants>$(DefineConstants);NET45</DefineConstants>
</PropertyGroup>
<!-- .NET 46 references, compilation flags and build options -->
<PropertyGroup Condition="$(TargetFramework.Contains('net46'))">
<DefineConstants>$(DefineConstants);NET46</DefineConstants>
</PropertyGroup>
<!-- .NET 47 references, compilation flags and build options -->
<PropertyGroup Condition="$(TargetFramework.Contains('net47'))">
<DefineConstants>$(DefineConstants);NET47</DefineConstants>
</PropertyGroup>
<!-- .NET 471 references, compilation flags and build options -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net471' ">
<DefineConstants>$(DefineConstants);NET471</DefineConstants>
</PropertyGroup>
<!-- .NET 472 references, compilation flags and build options -->
<PropertyGroup Condition=" '$(TargetFramework)' == 'net472' ">
<DefineConstants>$(DefineConstants);NET472</DefineConstants>
</PropertyGroup>
<!-- .NET 48 references, compilation flags and build options -->
<PropertyGroup Condition="$(TargetFramework.Contains('net48'))">
<DefineConstants>$(DefineConstants);NET48</DefineConstants>
</PropertyGroup>
<!-- Demonstrate the difference between a msbuild run from inside Visual Studio, and a msbuild called from dotnet CLI
Replace Never with Clean -->
<Target Name="HighlightDifferencesBetweenMSBuild" BeforeTargets="Never">
<Message Text="MSBuildRuntimeType = $(MSBuildRuntimeType)" />
<Message Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'" Text="SolutionDir undefined or null" />
<Message Condition="$(SolutionDir) != '' And $(SolutionDir) != '*Undefined*'" Text="SolutionDir =$(SolutionDir)" />
</Target>
<!--
<ItemGroup>
<Analyzer Include="..\..\packages\xunit.analyzers.0.7.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<Import Project="..\..\packages\xunit.core.2.3.1\build\xunit.core.targets" Condition="Exists('..\..\packages\xunit.core.2.3.1\build\xunit.core.targets')" />
-->
</Project>