Repository navigation
Expand file tree
/
Copy pathDirectory.Build.props
More file actions
57 lines (53 loc) · 3.35 KB
/
Copy pathDirectory.Build.props
File metadata and controls
57 lines (53 loc) · 3.35 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
<Project>
<PropertyGroup>
<Version>3.1.0</Version>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageProjectUrl>http://www.mudtools.cn/</PackageProjectUrl>
<RepositoryUrl>https://github.com/mudtools/MudHttpUtils</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageIcon>Icon.png</PackageIcon>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageTags>Mud;MudTools;Roslyn;SourceGenerator;CodeGenerator;代码生成器;AOT;ASP.NET;ASP.NET Core;.NET;.NET Core;</PackageTags>
<NoDefaultExcludes>true</NoDefaultExcludes>
<Copyright>© 2019-2026 Mud Studio Co.,Ltd.</Copyright>
<Authors>Mud Studio</Authors>
<Company>Mud Studio</Company>
<LangVersion>latest</LangVersion>
<NoWarn>CA1707;CA1021;CA1822;RS1035;NETSDK1210</NoWarn>
<AnalyzerLanguage>cs</AnalyzerLanguage>
<InjectIsExternalInitOnLegacy>true</InjectIsExternalInitOnLegacy>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
<CodeAnalysisTreatWarningsAsErrors>false</CodeAnalysisTreatWarningsAsErrors>
<BaseOutputPath>..\bin</BaseOutputPath>
</PropertyGroup>
<!-- 测试项目独立输出目录:.Tests 后缀项目不再共享 Tests/bin。
问题背景:所有测试项目默认输出到共享 Tests/bin,并行运行 dotnet test 时不同 TFM
的引用依赖(如 Microsoft.Extensions.Logging.Abstractions)在同一目录内互相覆盖/锁定
→ CS1705 版本不匹配等偶发失败。此处回退为各项目自己的 bin\(与团队标准布局一致,
也呼应 .gitignore 中 /Tests/<Proj>/bin、/Tests/<Proj>/obj 的既有条目)。
为什么放 props 而非 targets:OutputPath 默认值在 Microsoft.NET.Sdk.targets 内生成,
targets 晚于其导入,再改 BaseOutputPath 已不生效;props 在项目文件前导入,条件覆盖有效。
仅按项目名后缀匹配,不影响 AnalysisOnlyProbe/Benchmarks/Testing 等非 .Tests 项目。 -->
<PropertyGroup Condition="$(MSBuildProjectName.EndsWith('.Tests'))">
<BaseOutputPath>bin\</BaseOutputPath>
</PropertyGroup>
<!-- AOT 兼容性配置:仅在 .NET 8+ TFM 上启用 AOT 分析器。
netstandard2.0 与 net6.0 不支持 AOT 分析器,设置 IsAotCompatible 无实际效果。
各 csproj 不再单独设置 IsAotCompatible/EnableAotAnalyzer,统一由此处管控。 -->
<PropertyGroup Condition="'$(TargetFramework)' != 'netstandard2.0' AND '$(TargetFramework)' != 'net6.0' AND '$(IsAotCompatible)' == ''">
<IsAotCompatible>true</IsAotCompatible>
<EnableAotAnalyzer>true</EnableAotAnalyzer>
</PropertyGroup>
<!-- netstandard2.0/net6.0 不支持 AOT 分析器,抑制 NETSDK1210 噪声告警 -->
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' OR '$(TargetFramework)' == 'net6.0'">
<NoWarn>$(NoWarn);NETSDK1210</NoWarn>
</PropertyGroup>
<!-- 说明:AOT 严格模式的 WarningsAsErrors 注入已移至 Directory.Build.targets。
原因:本文件在项目文件【之前】导入,无法读取项目内定义的属性(如单个工程的
<MudExcludeFromAotStrictMode>true</MudExcludeFromAotStrictMode> 退出开关)。 -->
</Project>