|
1 | 1 | <Project Sdk="Microsoft.NET.Sdk"> |
2 | | - <PropertyGroup> |
3 | | - <TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks> |
| 2 | + <!-- General Properties ============================================== --> |
| 3 | + <PropertyGroup> |
| 4 | + <Configurations>Debug;Release;</Configurations> |
| 5 | + <RootNamespace /> |
4 | 6 | <AllowUnsafeBlocks>true</AllowUnsafeBlocks> |
5 | | - <RootNamespace /> |
6 | 7 | </PropertyGroup> |
7 | 8 |
|
| 9 | + <!-- Strong name signing ============================================= --> |
| 10 | + <PropertyGroup> |
| 11 | + <AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile> |
| 12 | + </PropertyGroup> |
| 13 | + <PropertyGroup Condition="'$(CDP_BUILD_TYPE)' == 'Official'"> |
| 14 | + <SignAssembly>true</SignAssembly> |
| 15 | + <KeyFile>$(SigningKeyPath)</KeyFile> |
| 16 | + </PropertyGroup> |
| 17 | + |
| 18 | + |
8 | 19 | <!-- OS Constants ==================================================== --> |
9 | 20 | <PropertyGroup> |
| 21 | + <!-- @TODO: Move to directory.build.props? --> |
10 | 22 | <!-- If a target OS was not specified, use the current OS as the target OS. --> |
11 | 23 | <TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs> |
12 | 24 |
|
13 | 25 | <!-- Uncomment the following line to override the OS you are developing for --> |
14 | 26 | <!--<TargetOs>Unix</TargetOs>--> |
15 | 27 | <!--<TargetOs>Windows_NT</TargetOs>--> |
16 | 28 |
|
| 29 | + <NormalizedTargetOs>$(TargetOs.ToLower())</NormalizedTargetOs> |
| 30 | + |
17 | 31 | <!-- NOTE: These constants are prefixed with _ to keep them separate from .NET 5+ precompiler --> |
18 | | - <!-- flags. Those only apply to OS-specific target frameworks, and would interfere here. --> |
19 | | - <DefineConstants Condition="'$(TargetOs.ToUpper())' == 'UNIX'">$(DefineConstants),_UNIX</DefineConstants> |
20 | | - <DefineConstants Condition="'$(TargetOs.ToUpper())' == 'WINDOWS_NT'">$(DefineConstants),_WINDOWS</DefineConstants> |
| 32 | + <!-- flags. Those only apply to OS-specific target frameworks, and would interfere here. --> |
| 33 | + <DefineConstants Condition="'$(NormalizedTargetOs)' == 'unix'">$(DefineConstants);_UNIX</DefineConstants> |
| 34 | + <DefineConstants Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(DefineConstants);_WINDOWS</DefineConstants> |
| 35 | + </PropertyGroup> |
| 36 | + |
| 37 | + <!-- Target Frameworks =============================================== --> |
| 38 | + <PropertyGroup> |
| 39 | + <!-- net462 is only supported on Windows, so we will only add it if we're building for Windows --> |
| 40 | + <TargetFrameworks>net8.0;net9.0</TargetFrameworks> |
| 41 | + <TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(TargetFrameworks);net462</TargetFrameworks> |
| 42 | + </PropertyGroup> |
| 43 | + |
| 44 | + <!-- Build Output ==================================================== --> |
| 45 | + <PropertyGroup> |
| 46 | + <!-- @TODO: Move to directory.build.props? --> |
| 47 | + <ArtifactPath>$(RepoRoot)artifacts/</ArtifactPath> |
| 48 | + |
| 49 | + <!-- MSBuild will add the target framework to the end of this path by default. Telling it not --> |
| 50 | + <!-- to is possible but requires also specifying the IntermediateOutputPath. So while it --> |
| 51 | + <!-- would be nice to have a flat directory structure, it's more hassle than its worth. --> |
| 52 | + <OutputPath>$(ArtifactPath)$(AssemblyName)/$(Configuration)/$(NormalizedTargetOs)/</OutputPath> |
21 | 53 | </PropertyGroup> |
22 | 54 |
|
23 | 55 | <!-- Embedded resources ============================================== --> |
24 | 56 | <ItemGroup> |
| 57 | + <!-- Linker directives to replace UseManagedNetworking with a constant if consumer specifies --> |
| 58 | + <!-- the app context switch in their csproj. This file only applies to netcore on windows. --> |
| 59 | + <!-- This file does not support pre-processor directives, so it must be conditionally --> |
| 60 | + <!-- included into the build. --> |
25 | 61 | <EmbeddedResource Include="Resources/ILLink.Substitutions.xml" |
26 | | - Condition="'$(TargetOs.ToUpper())' == 'WINDOWS_NT'" /> |
| 62 | + Condition="'$(NormalizedTargetOs)' == 'windows_nt' AND '$(TargetFramework)' != 'net462'" /> |
27 | 63 | </ItemGroup> |
28 | 64 |
|
29 | 65 | <!-- References ====================================================== --> |
30 | | - <ItemGroup> |
31 | | - <!-- References that apply to all target frameworks --> |
| 66 | + <!-- References for netframework --> |
| 67 | + <ItemGroup Condition="'$(TargetFramework)' == 'net462'"> |
| 68 | + <Reference Include="System.Configuration" /> |
| 69 | + <Reference Include="System.EnterpriseServices" /> |
| 70 | + <Reference Include="System.Transactions" /> |
| 71 | + |
32 | 72 | <PackageReference Include="Azure.Core" /> |
33 | 73 | <PackageReference Include="Azure.Identity" /> |
34 | 74 | <PackageReference Include="Microsoft.Bcl.Cryptography" /> |
| 75 | + <PackageReference Include="Microsoft.Data.SqlClient.SNI"> |
| 76 | + <PrivateAssets>All</PrivateAssets> |
| 77 | + <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> |
| 78 | + </PackageReference> |
35 | 79 | <PackageReference Include="Microsoft.Extensions.Caching.Memory" /> |
36 | 80 | <PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" /> |
37 | 81 | <PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" /> |
38 | | - <PackageReference Include="System.Configuration.ConfigurationManager" /> |
39 | | - <PackageReference Include="System.Security.Cryptography.Pkcs" /> |
40 | | - </ItemGroup> |
41 | | - <ItemGroup Condition="'$(TargetFramework)' == 'net462'"> |
42 | | - <!-- References that only apply to net462 --> |
43 | | - <Reference Include="System.Configuration" /> |
44 | | - <Reference Include="System.Transactions" /> |
45 | | - <PackageReference Include="System.ValueTuple" /> |
46 | | - <PackageReference Include="System.Threading.Channels" /> |
47 | | - </ItemGroup> |
48 | | - |
49 | | - <!-- System.Buffers, System.Memory, and System.Runtime.InteropServices.RuntimeInformation are included in .NET 10+ BCL --> |
50 | | - <ItemGroup Condition="$([MSBuild]::VersionLessThan($([MSBuild]::GetTargetFrameworkVersion($(TargetFramework))), '10.0'))"> |
51 | 82 | <PackageReference Include="System.Buffers" /> |
| 83 | + <PackageReference Include="System.Diagnostics.DiagnosticSource" /> |
52 | 84 | <PackageReference Include="System.Memory" /> |
53 | 85 | <PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" /> |
| 86 | + <PackageReference Include="System.Security.Cryptography.Pkcs" /> |
| 87 | + <PackageReference Include="System.Text.Json" /> |
| 88 | + <PackageReference Include="System.Threading.Channels" /> |
| 89 | + <PackageReference Include="System.ValueTuple" /> |
| 90 | + </ItemGroup> |
| 91 | + |
| 92 | + <!-- References for netcore --> |
| 93 | + <ItemGroup Condition="'$(TargetFramework)' != 'net462'"> |
| 94 | + <PackageReference Include="Azure.Core" /> |
| 95 | + <PackageReference Include="Azure.Identity" /> |
| 96 | + <PackageReference Include="Microsoft.Bcl.Cryptography" /> |
| 97 | + <PackageReference Include="Microsoft.Data.SqlClient.SNI.runtime" /> |
| 98 | + <PackageReference Include="Microsoft.Extensions.Caching.Memory" /> |
| 99 | + <PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" /> |
| 100 | + <PackageReference Include="Microsoft.IdentityModel.Protocols.OpenIdConnect" /> |
| 101 | + <PackageReference Include="Microsoft.SqlServer.Server" /> |
| 102 | + <PackageReference Include="System.Configuration.ConfigurationManager" /> |
| 103 | + <PackageReference Include="System.Security.Cryptography.Pkcs" /> |
54 | 104 | </ItemGroup> |
| 105 | + |
| 106 | + <!-- CodeGen Targets ================================================= --> |
| 107 | + <Import Project="$(ToolsDir)targets\GenerateThisAssemblyCs.targets" /> |
55 | 108 | </Project> |
0 commit comments