-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDirectory.Build.props
269 lines (266 loc) · 15 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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
<Project>
<!-- Properties in this file is not needed to change in general,
please provide your good idea if you change this file content -->
<Import Project="$([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..))"
Condition ="Exists($([MSBuild]::GetPathOfFileAbove($(MSBuildThisFile), $(MSBuildThisFileDirectory)..)))" />
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Debug.props, $(MSBuildThisFileDirectory)))" Condition="Exists($([MSBuild]::GetPathOfFileAbove(Directory.Debug.props, $(MSBuildThisFileDirectory))))" />
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Config.props, $(MSBuildThisFileDirectory)))" Condition="Exists($([MSBuild]::GetPathOfFileAbove(Directory.Config.props, $(MSBuildThisFileDirectory))))" />
<PropertyGroup Label="RootPath">
<PropsDir>$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory)))</PropsDir>
<ProjDir>$([MSBuild]::NormalizeDirectory($(MSBuildProjectDirectory)))</ProjDir>
<AssertDir>$([MSBuild]::NormalizeDirectory("$(PropsDir)","solution"))</AssertDir>
</PropertyGroup>
<PropertyGroup Label="Project">
<BuildInParallel Condition="'$(BuildInParallel)' ==''">true</BuildInParallel>
<NeutralLanguage>zh-CHS</NeutralLanguage>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<NoWarn>$(NoWarn);NU5105;1701;1702;1591;8002</NoWarn>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<Nullable>annotations</Nullable>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<RootNamespace>$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<Optimize Condition="'$(Configuration)'=='Release'">true</Optimize>
<DebugType>portable</DebugType>
<SuppressNETCoreSdkPreviewMessage>true</SuppressNETCoreSdkPreviewMessage>
<BuildOutput>$(PropsDir).build</BuildOutput>
<BaseIntermediateOutputPath>$([MSBuild]::NormalizeDirectory($(BuildOutput),"obj",$(MSBuildProjectName)))</BaseIntermediateOutputPath>
<BaseOutputPath>$([MSBuild]::NormalizeDirectory($(BuildOutput),"bin",$(MSBuildProjectName)))</BaseOutputPath>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<PropertyGroup Label="Generates">
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<GenerateDependencyFile>true</GenerateDependencyFile>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GeneratePackageOnBuild Condition="'$(IsTestProject)' != 'true'">true</GeneratePackageOnBuild>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateFullPaths Condition="'$(TERM_PROGRAM)' == 'vscode'">true</GenerateFullPaths>
<!--如果将 GenerateAssemblyInfo 设置为 false,xunit 无法执行,因为 xunit 需要使用程序集信息来查找测试。-->
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateAssemblyVersionAttribute>true</GenerateAssemblyVersionAttribute>
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateAssemblyInformationalVersionAttribute>true</GenerateAssemblyInformationalVersionAttribute>
</PropertyGroup>
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<!-- 只有在 GitHub 的 Action 构建才能使用源代码链接 -->
<!-- 源代码链接需要使用 commit 号,而在 GitHub 的 Action 构建的 commit 才是对的 -->
<!-- 本地构建,也许没有记得 commit 就构建,此时的 nuget 包的源代码是不对的,上传上去会让调试诡异 -->
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
<EmbedUntrackedSources>false</EmbedUntrackedSources>
<!-- 本地等不需要创建符号文件 -->
<!-- Optional: Build symbol package (.snupkg) to distribute the PDB containing Source Link -->
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>
<ItemGroup>
<None Include="$(PropsDir)**/*.props" Exclude="$(PropsDir)**/*.g.props;$(BaseOutputPath)**/***.props;$(BaseIntermediateOutputPath)**/***.props">
<Link> Solution Items/Directory.Build/%(RecursiveDir)/%(Filename)%(Extension)</Link>
</None>
<None Include="$(PropsDir)**/*.targets" Exclude="$(PropsDir)**/*.g.targets">
<Link> Solution Items/Directory.Build/%(RecursiveDir)/%(Filename)%(Extension)</Link>
</None>
<None Include="$(PropsDir)*.*" Exclude="$(PropsDir)**/*.props;$(PropsDir)**/*.targets">
<Link> Solution Items/%(Filename)%(Extension)</Link>
</None>
<None Include="$(PropsDir).github/**/*.*">
<Link> Solution Items/.github/%(RecursiveDir)/%(Filename)%(Extension)</Link>
</None>
<None Include="$(PropsDir).gitee/**/*.*">
<Link> Solution Items/.gitee/%(RecursiveDir)/%(Filename)%(Extension)</Link>
</None>
<!--<None Include="$(PropsDir)**/*.csproj" Condition="Exists('$(PropsDir)')">
<Link> Solution Items/.csproj/%(Filename)%(Extension)</Link>
</None>-->
<None Include="$(AssertDir)**/*.*" Condition="Exists('$(AssertDir)')">
<Link> Solution Items/%(RecursiveDir)/%(Filename)%(Extension)</Link>
</None>
</ItemGroup>
<ItemDefinitionGroup>
<!-- We always want MSBuild properties generated that point at the restored location of each package. -->
<PackageReference GeneratePathProperty="true" />
</ItemDefinitionGroup>
<ItemGroup Condition="Exists('$(MSBuildThisFileDirectory)stylecop.json')">
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
<ItemGroup>
<None Condition="Exists('$(MSBuildThisFileDirectory)3rdPartyNotices.txt')" Include="$(MSBuildThisFileDirectory)3rdPartyNotices.txt" Pack="true" PackagePath="" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Condition="'$(GITHUB_ACTIONS)' == 'true' and '$(IsTestProject)' != 'true'">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="all" Version="3.6.133" />
<PackageReference Include="CSharpIsNullAnalyzer" Version="0.1.495" />
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.59" />
<PackageReference Include="Nullable" Version="1.3.1" />
<PackageReference Include="StyleCop.Analyzers.Unstable" Version="1.2.0.507" />
</ItemGroup>
<Target Name="PrepareReleaseNotes" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion">
<PropertyGroup>
<PackageReleaseNotes Condition="'$(PackageProjectUrl)'!=''">$(PackageProjectUrl)/releases/tag/v$(Version)</PackageReleaseNotes>
</PropertyGroup>
</Target>
<PropertyGroup>
<ReadmeInTree>$([MSBuild]::NormalizePath($([MSBuild]::ValueOrDefault('$([MSBuild]::GetPathOfFileAbove(README.md,$(ProjDir)))','$(AssertDir)README.md'))))</ReadmeInTree>
<IconPngInTree>$([MSBuild]::NormalizePath($([MSBuild]::ValueOrDefault('$([MSBuild]::GetPathOfFileAbove(icon.png,$(ProjDir)))','$(AssertDir)icon.png'))))</IconPngInTree>
<AppIcoInTree>$([MSBuild]::NormalizePath($([MSBuild]::ValueOrDefault('$([MSBuild]::GetPathOfFileAbove(app.ico,$(ProjDir)))','$(AssertDir)app.ico'))))</AppIcoInTree>
<ChangeLogInTree Condition="'$(ChangeLogFileName)'!=''">$([MSBuild]::NormalizePath($([MSBuild]::ValueOrDefault('$([MSBuild]::GetPathOfFileAbove($([System.IO.Path]::GetFileName('$(ChangeLogFileName)')),$(ProjDir)))','$(AssertDir)$([System.IO.Path]::GetFileName('$(ChangeLogFileName)'))'))))</ChangeLogInTree>
<DescriptionInTree Condition="'$(ProjectDescriptionFileName)'!=''">$([MSBuild]::NormalizePath($([MSBuild]::ValueOrDefault('$([MSBuild]::GetPathOfFileAbove($([System.IO.Path]::GetFileName('$(ProjectDescriptionFileName)')),$(ProjDir)))','$(AssertDir)$([System.IO.Path]::GetFileName('$(ProjectDescriptionFileName)'))'))))</DescriptionInTree>
<CertificateFileInTree Condition="'$(CertificateFileName)'!=''">$([MSBuild]::NormalizePath($([MSBuild]::ValueOrDefault('$([MSBuild]::GetPathOfFileAbove($([System.IO.Path]::GetFileName('$(CertificateFileName)')),$(ProjDir)))','$(AssertDir)$([System.IO.Path]::GetFileName('$(CertificateFileName)'))'))))</CertificateFileInTree>
</PropertyGroup>
<!-- PackageReadmeFile -->
<Choose>
<When Condition="Exists('$(ReadmeInTree)')">
<PropertyGroup>
<PackageReadmeFile>README.md</PackageReadmeFile>
<ReadmeFinalPath>$(ReadmeInTree)</ReadmeFinalPath>
</PropertyGroup>
<ItemGroup>
<None Include="$(ReadmeInTree)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
</Choose>
<!--PackageIcon-->
<Choose>
<When Condition="Exists('$(IconPngInTree)')">
<PropertyGroup>
<PackageIcon>icon.png</PackageIcon>
<PackageIconFinalPath>$(IconPngInTree)</PackageIconFinalPath>
</PropertyGroup>
<ItemGroup>
<None Include="$(IconPngInTree)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
</Choose>
<!--ApplicationIcon - Load app.ico file for ApplicationIcon(.exe)-->
<Choose>
<When Condition="Exists('$(AppIcoInTree)')">
<PropertyGroup>
<ApplicationIcon>$(AppIcoInTree)</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<None Include="$(AppIcoInTree)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
</Choose>
<!--PackageReleaseNotes $(ChangeLogFileName)-->
<Choose>
<When Condition="'$(ChangeLogFileName)'!='' And $([System.IO.Path]::IsPathRooted($(ChangeLogFileName))) and Exists('$(ChangeLogFileName)')">
<PropertyGroup>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(ChangeLogFileName)"))</PackageReleaseNotes>
<ChangeLogFinalPath>$(ChangeLogFileName)</ChangeLogFinalPath>
</PropertyGroup>
<ItemGroup>
<None Include="$(ChangeLogFileName)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
<When Condition="'$(ChangeLogInTree)'!='' and Exists('$(ChangeLogInTree)')">
<PropertyGroup>
<PackageReleaseNotes>$([System.IO.File]::ReadAllText("$(ChangeLogInTree)"))</PackageReleaseNotes>
<ChangeLogFinalPath>$(ChangeLogInTree)</ChangeLogFinalPath>
</PropertyGroup>
<ItemGroup>
<None Include="$(ChangeLogInTree)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
</Choose>
<!-- Description and PackageDescription-->
<!--A long description for the assembly. If PackageDescription is not specified, then this property is also used as the description of the package.-->
<Choose>
<When Condition="'$(ProjectDescriptionFileName)'!='' And $([System.IO.Path]::IsPathRooted($(ProjectDescriptionFileName))) AND Exists('$(ProjectDescriptionFileName)')">
<PropertyGroup>
<DescriptionFinalContent>$([System.IO.File]::ReadAllText("$(ProjectDescriptionFileName)"))</DescriptionFinalContent>
<DescriptionFinalPath>$(ProjectDescriptionFileName)</DescriptionFinalPath>
</PropertyGroup>
<ItemGroup>
<None Include="$(ProjectDescriptionFileName)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
<When Condition="'$(DescriptionInTree)'!='' and Exists('$(DescriptionInTree)')">
<PropertyGroup>
<DescriptionFinalContent>$([System.IO.File]::ReadAllText("$(DescriptionInTree)"))</DescriptionFinalContent>
<DescriptionFinalPath>$(DescriptionInTree)</DescriptionFinalPath>
</PropertyGroup>
<ItemGroup>
<None Include="$(DescriptionInTree)" Pack="True" PackagePath="/" Visible="True" />
</ItemGroup>
</When>
<When Condition="'$(ReadmeFinalPath)'!='' and Exists('$(ReadmeFinalPath)')">
<PropertyGroup>
<DescriptionFinalContent>$([System.IO.File]::ReadAllText('$(ReadmeFinalPath)'))</DescriptionFinalContent>
<DescriptionFinalPath>$(ReadmeFinalPath)</DescriptionFinalPath>
</PropertyGroup>
</When>
<When Condition="'$(ChangeLogFinalPath)'!='' and Exists('$(ChangeLogFinalPath)')">
<PropertyGroup>
<DescriptionFinalContent>$([System.IO.File]::ReadAllText('$(ChangeLogFinalPath)'))</DescriptionFinalContent>
<DescriptionFinalPath>$(ChangeLogFinalPath)</DescriptionFinalPath>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<!--default description for all packages-->
<!--<PackageDescription></PackageDescription>-->
</PropertyGroup>
</Otherwise>
</Choose>
<Choose>
<When Condition="$(DescriptionFinalContent.Length)>1000">
<PropertyGroup>
<DescriptionFinalContent>$(DescriptionFinalContent.SubString(0,1000))</DescriptionFinalContent>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup Condition="'$(DescriptionFinalContent)' !=''">
<Description>$(DescriptionFinalContent)</Description>
<!--default description for all packages-->
<!--<PackageDescription></PackageDescription>-->
</PropertyGroup>
<!-- AssemblyOriginatorKeyFile and PackageCertificateKeyFile -->
<Choose>
<When Condition="'$(IsTestProject)'=='True'">
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
</When>
<When Condition="'$(CertificateFileName)'!='' And $([System.IO.Path]::IsPathRooted($(CertificateFileName))) and Exists('$(CertificateFileName)')">
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(CertificateFileName)</AssemblyOriginatorKeyFile>
<PackageCertificateKeyFile>$(CertificateFileName)</PackageCertificateKeyFile>
</PropertyGroup>
</When>
<When Condition="'$(CertificateFileInTree)'!='' and Exists('$(CertificateFileInTree)')">
<PropertyGroup>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>$(CertificateFileInTree)</AssemblyOriginatorKeyFile>
<PackageCertificateKeyFile>$(CertificateFileInTree)</PackageCertificateKeyFile>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup Label="TFM" Condition="!Exists($([MSBuild]::GetPathOfFileAbove(Directory.Config.props, $(MSBuildThisFileDirectory))))">
<TFMS_LIB>net7.0</TFMS_LIB>
<TFMS_NORMAL>net7.0</TFMS_NORMAL>
<TFMS_TEST>net7.0</TFMS_TEST>
<TFMS_SINGLE>net7.0</TFMS_SINGLE>
<TFMS_WINDOWS>net7.0-windows</TFMS_WINDOWS>
</PropertyGroup>
<PropertyGroup Label="Versions">
<LangVersion>latest</LangVersion>
<!--使用Nerdbank.GitVersioning控制版本,不在设置版本号-->
<!--<VersionPrefix>0.1.0</VersionPrefix>
<VersionSuffix>beta</VersionSuffix>-->
<!--<Version>0.0.1</Version>-->
<!--产品版本 如果不指定,将会由 VersionPrefix.VersionSuffix 强签名组成-->
<!--<InformationalVersion>This is a prerelease package</InformationalVersion>-->
</PropertyGroup>
<Import Project="$(MSBuildProjectDirectory)\releasenotes.props" Condition="Exists('$(MSBuildProjectDirectory)\releasenotes.props')" />
<!--
MSBuild 中,如果一个属性在项目文件中被重复定义了,那么哪一个会生效呢?
这取决于属性的定义顺序和作用域。一般来说,MSBuild 会使用最后一个定义的属性值,除非该属性被标记为不可覆盖(immutable)
如果属性是在全局作用域中重复定义的,那么最后一个定义的值会生效。
如果属性是在条件作用域中重复定义的,那么最后一个满足条件的值会生效。
如果属性是在目标或任务作用域中重复定义的,那么它们会覆盖全局或条件作用域中的值,但只在该目标或任务内有效。
-->
</Project>