-
Notifications
You must be signed in to change notification settings - Fork 317
Merge Project | Build the Common Project #3837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
871859c
8250468
d253767
477219d
70fa18f
61978e1
946f41b
2e92020
8d4ca14
4c25b0f
2a0ff49
ca43c20
392702b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- Build Parameters ============================================== --> | ||
| <PropertyGroup> | ||
| <!-- Configuration: Which build configuration to build --> | ||
| <!-- Allowed values: Debug, Release --> | ||
| <!-- Default value: Debug --> | ||
| <Configuration Condition="'$(Configuration)' == ''">Debug</Configuration> | ||
|
|
||
| <!-- DotnetPath: Path to folder containing the `dotnet` binary. Override this if a --> | ||
| <!-- specific version (eg, x86) is required. Otherwise, this defaults to using the --> | ||
| <!-- dotnet binary in the PATH variable. The provided path should end with a `\` (or --> | ||
| <!-- `/`) character. Eg. C:\x86\ --> | ||
| <DotnetPath Condition="'$(DotnetPath)' == ''"></DotnetPath> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- Imports ======================================================= --> | ||
| <Import Project="src/Directory.Build.props" /> | ||
|
|
||
| <!-- Microsoft.Data.SqlClient Build Targets ======================== --> | ||
| <PropertyGroup> | ||
| <MdsProjectPath>$(RepoRoot)src/Microsoft.Data.SqlClient/src/Microsoft.Data.SqlClient.csproj</MdsProjectPath> | ||
| </PropertyGroup> | ||
|
|
||
| <!-- BuildMds: Builds all binaries for MDS --> | ||
| <Target Name="BuildMds" DependsOnTargets="BuildMdsUnix;BuildMdsWindows" /> | ||
|
|
||
| <!-- BuildMdsUnix: Builds all unix-specific MDS binaries --> | ||
| <Target Name="BuildMdsUnix"> | ||
| <PropertyGroup> | ||
| <DotnetCommand> | ||
| $(DotnetPath)dotnet build $(MdsProjectPath) | ||
| -p:Configuration=$(Configuration) | ||
| -p:TargetOs=Unix | ||
| </DotnetCommand> | ||
| <!-- Convert more than one whitespace character into one space --> | ||
| <DotnetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " "))</DotnetCommand> | ||
| </PropertyGroup> | ||
| <Message Text=">>> Building MDS for Unix via command: $(DotnetCommand)"/> | ||
| <Exec ConsoleToMsBuild="true" Command="$(DotnetCommand)" /> | ||
| </Target> | ||
|
|
||
| <!-- BuildMdsWindows: Builds all windows-specific MDS binaries --> | ||
| <Target Name="BuildMdsWindows"> | ||
| <PropertyGroup> | ||
| <DotnetCommand> | ||
| $(DotnetPath)dotnet build $(MdsProjectPath) | ||
| -p:Configuration=$(Configuration) | ||
| -p:TargetOs=Windows_NT | ||
| </DotnetCommand> | ||
| <!-- Convert more than one whitespace character into one space --> | ||
| <DotnetCommand>$([System.Text.RegularExpressions.Regex]::Replace($(DotnetCommand), "\s+", " "))</DotnetCommand> | ||
| </PropertyGroup> | ||
| <Message Text=">>> Building MDS for Windows via command: $(DotnetCommand)"/> | ||
| <Exec ConsoleToMsBuild="true" Command="$(DotnetCommand)" /> | ||
| </Target> | ||
| </Project> | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,55 +1,108 @@ | ||||||||||||||||||||||||||||||
| <Project Sdk="Microsoft.NET.Sdk"> | ||||||||||||||||||||||||||||||
| <PropertyGroup> | ||||||||||||||||||||||||||||||
| <TargetFrameworks>net462;net8.0;net9.0</TargetFrameworks> | ||||||||||||||||||||||||||||||
| <!-- General Properties ============================================== --> | ||||||||||||||||||||||||||||||
| <PropertyGroup> | ||||||||||||||||||||||||||||||
| <Configurations>Debug;Release;</Configurations> | ||||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see this property documented - what do we think it's doing?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought it was defining the allowed configurations that the project can be built in. But... yeah, I don't see it in the docs anywhere. I will remove it.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The Configurations should be specified to allow Release configuration to be picked up for building.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The new Abstractions and Azure projects don't specify these and they have no problem building in Debug or Release configuration. Are we sure this isn't from the legacy .NET Framework style projects?
|
||||||||||||||||||||||||||||||
| <RootNamespace /> | ||||||||||||||||||||||||||||||
| <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||||||||||||||||||||||||||||
| <RootNamespace /> | ||||||||||||||||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <!-- Strong name signing ============================================= --> | ||||||||||||||||||||||||||||||
| <PropertyGroup> | ||||||||||||||||||||||||||||||
| <AssemblyOriginatorKeyFile>$(SigningKeyPath)</AssemblyOriginatorKeyFile> | ||||||||||||||||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||||||||||||||
| <PropertyGroup Condition="'$(CDP_BUILD_TYPE)' == 'Official'"> | ||||||||||||||||||||||||||||||
| <SignAssembly>true</SignAssembly> | ||||||||||||||||||||||||||||||
| <KeyFile>$(SigningKeyPath)</KeyFile> | ||||||||||||||||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <!-- OS Constants ==================================================== --> | ||||||||||||||||||||||||||||||
| <PropertyGroup> | ||||||||||||||||||||||||||||||
| <!-- @TODO: Move to directory.build.props? --> | ||||||||||||||||||||||||||||||
| <!-- If a target OS was not specified, use the current OS as the target OS. --> | ||||||||||||||||||||||||||||||
| <TargetOs Condition="'$(TargetOs)' == ''">$(OS)</TargetOs> | ||||||||||||||||||||||||||||||
paulmedynski marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <!-- Uncomment the following line to override the OS you are developing for --> | ||||||||||||||||||||||||||||||
| <!--<TargetOs>Unix</TargetOs>--> | ||||||||||||||||||||||||||||||
| <!--<TargetOs>Windows_NT</TargetOs>--> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <NormalizedTargetOs>$(TargetOs.ToLower())</NormalizedTargetOs> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <!-- NOTE: These constants are prefixed with _ to keep them separate from .NET 5+ precompiler --> | ||||||||||||||||||||||||||||||
| <!-- flags. Those only apply to OS-specific target frameworks, and would interfere here. --> | ||||||||||||||||||||||||||||||
| <DefineConstants Condition="'$(TargetOs.ToUpper())' == 'UNIX'">$(DefineConstants),_UNIX</DefineConstants> | ||||||||||||||||||||||||||||||
| <DefineConstants Condition="'$(TargetOs.ToUpper())' == 'WINDOWS_NT'">$(DefineConstants),_WINDOWS</DefineConstants> | ||||||||||||||||||||||||||||||
| <!-- flags. Those only apply to OS-specific target frameworks, and would interfere here. --> | ||||||||||||||||||||||||||||||
| <DefineConstants Condition="'$(NormalizedTargetOs)' == 'unix'">$(DefineConstants);_UNIX</DefineConstants> | ||||||||||||||||||||||||||||||
| <DefineConstants Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(DefineConstants);_WINDOWS</DefineConstants> | ||||||||||||||||||||||||||||||
|
Comment on lines
+33
to
+34
|
||||||||||||||||||||||||||||||
| </PropertyGroup> | ||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||
| <!-- Target Frameworks =============================================== --> | ||||||||||||||||||||||||||||||
| <PropertyGroup> | ||||||||||||||||||||||||||||||
| <!-- net462 is only supported on Windows, so we will only add it if we're building for Windows --> | ||||||||||||||||||||||||||||||
| <TargetFrameworks>net8.0;net9.0</TargetFrameworks> | ||||||||||||||||||||||||||||||
| <TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(TargetFrameworks);net462</TargetFrameworks> | ||||||||||||||||||||||||||||||
|
Comment on lines
+40
to
+41
|
||||||||||||||||||||||||||||||
| <TargetFrameworks>net8.0;net9.0</TargetFrameworks> | |
| <TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">$(TargetFrameworks);net462</TargetFrameworks> | |
| <TargetFrameworks Condition="'$(NormalizedTargetOs)' != 'windows_nt'">net8.0;net9.0</TargetFrameworks> | |
| <TargetFrameworks Condition="'$(NormalizedTargetOs)' == 'windows_nt'">net462;net8.0;net9.0</TargetFrameworks> |
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO comment suggests moving ArtifactPath to directory.build.props. However, this property is being used in a non-standard way and conflicts with the existing Artifacts property defined in Directory.Build.props (line 38). The existing convention uses $(Artifacts) which includes the ReferenceType folder. This should be reconciled before moving to a shared location to avoid breaking existing builds.
| <!-- @TODO: Move to directory.build.props? --> | |
| <ArtifactPath>$(RepoRoot)artifacts/</ArtifactPath> | |
| <!-- MSBuild will add the target framework to the end of this path by default. Telling it not --> | |
| <!-- to is possible but requires also specifying the IntermediateOutputPath. So while it --> | |
| <!-- would be nice to have a flat directory structure, it's more hassle than its worth. --> | |
| <OutputPath>$(ArtifactPath)$(AssemblyName)/$(Configuration)/$(NormalizedTargetOs)/</OutputPath> | |
| <!-- Project-specific artifact root; kept local to avoid conflicts with global $(Artifacts) conventions. --> | |
| <SqlClientArtifactPath>$(RepoRoot)artifacts/</SqlClientArtifactPath> | |
| <!-- MSBuild will add the target framework to the end of this path by default. Telling it not --> | |
| <!-- to is possible but requires also specifying the IntermediateOutputPath. So while it --> | |
| <!-- would be nice to have a flat directory structure, it's more hassle than its worth. --> | |
| <OutputPath>$(SqlClientArtifactPath)$(AssemblyName)/$(Configuration)/$(NormalizedTargetOs)/</OutputPath> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's follow the conversation at #3843 and make changes here accordingly. Doesn't necessarily need to be in this PR.
Copilot
AI
Dec 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The package reference organization contains duplicate references between the net462 and netcore sections. Both sections include identical packages like Azure.Core, Azure.Identity, Microsoft.Bcl.Cryptography, Microsoft.Extensions.Caching.Memory, Microsoft.IdentityModel.JsonWebTokens, Microsoft.IdentityModel.Protocols.OpenIdConnect, and System.Security.Cryptography.Pkcs. These shared packages should be moved to a common ItemGroup that applies to all target frameworks to reduce duplication and maintenance burden.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't forget strong name key signing is a MUST.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good catch. I will get that in on this PR. Otherwise, I'll definitely forget.