Skip to content

Commit

Permalink
Merge branch 'main' into revert-10942-respect-warningsAsErrors-and-ot…
Browse files Browse the repository at this point in the history
…hers-without-prefix
  • Loading branch information
SimaTian authored Nov 29, 2024
2 parents ad91319 + 3d1e2cf commit 00c89e9
Show file tree
Hide file tree
Showing 55 changed files with 1,014 additions and 93 deletions.
55 changes: 39 additions & 16 deletions azure-pipelines/vs-insertion.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,46 @@
# Create a VS insertion (DotNet-MSBuild-Trusted -> VS) from a build artifact on main or any servicing branch.
# Create a VS insertion (DotNet-MSBuild-Trusted -> VS) from a CI run on main or any servicing branch.
# To achieve insertion automation, this pipeline definition yml has to be on servicing branches and main.


# Runs in 3 modes:
# 1. daily main insertion from latest main CI.
# - can be disabled in the UI by adding a custom schedule for any branch.
# 2. trigger insert as a followup to a servicing CI run.
# - can be disabled in the UI by adding a custom CI trigger.
# 3. manual insertion - select manually the TargetBranch and inserted CI run.
trigger: none
pr: none
name: $(Date:yyyyMMdd).$(Rev:r)

schedules:
- cron: '0 3 * * 1-5' # Runs every weekday at 3AM UTC
displayName: Daily VS insertion main
branches:
include:
- main
always: false # Don't run if there are no code changes

resources:
pipelines:
- pipeline: 'MSBuild'
project: 'DevDiv'
source: 'MSBuild'
branch: main # for daily main scheduled insertion
trigger:
branches:
include: # trigger as a followup to servicing CI
- vs*
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

schedules:
- cron: '0 3 * * *' # Runs every day at 3AM UTC
displayName: Daily VS insertion
branches:
include:
- main
- vs*
always: false # Don't run if there are no code changes

parameters:
- name: TargetBranch
default: auto
type: string
displayName: 'Insertion Target Branch (recommended to use `auto`)'
displayName: 'Insertion Target Branch (select for manual insertion)'
values:
- auto
- main
Expand Down Expand Up @@ -88,6 +102,11 @@ variables:
value: '$(ArtifactPackagesPath)/Microsoft.NET.StringTools*.nupkg'
- name: ExternalAPIsPackagePattern
value: '$(ArtifactPackagesPath)/VS.ExternalAPIs.*.nupkg'
# servicing branches until 17.12 also include Microsoft.Build.Engine and Microsoft.Build.Conversion.Core
- name: EngineIncludedProps
value: VS.ExternalAPIs.MSBuild=$(MSBuild_ExtApisPackageVersion);Microsoft.Build=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Conversion.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Engine=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Framework=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Tasks.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Utilities.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.NET.StringTools=$(MicrosoftNETStringToolsPackageVersion)
- name: NoEngineProps
value: VS.ExternalAPIs.MSBuild=$(MSBuild_ExtApisPackageVersion);Microsoft.Build=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Framework=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Tasks.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Utilities.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.NET.StringTools=$(MicrosoftNETStringToolsPackageVersion)

extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
Expand Down Expand Up @@ -186,6 +205,14 @@ extends:
$packageVersion = $packageFile.BaseName.TrimStart("Microsoft.NET.StringTools")
Write-Host "Setting MicrosoftNETStringToolsPackageVersion to '$packageVersion'"
Write-Host "##vso[task.setvariable variable=MicrosoftNETStringToolsPackageVersion]$($packageVersion)"
if ("$(InsertTargetBranch)" -in @("vs17.0", "vs17.3", "vs17.6", "vs17.8", "vs17.10", "vs17.11", "vs17.12"))
{
Write-Host "##vso[task.setvariable variable=InsertPackagePropsValues]$($EngineIncludedProps)"
}
else
{
Write-Host "##vso[task.setvariable variable=InsertPackagePropsValues]$($NoEngineProps)"
}
- task: 1ES.PublishNuGet@1
displayName: 'Push MSBuild CoreXT packages'
inputs:
Expand Down Expand Up @@ -221,11 +248,7 @@ extends:
TeamEmail: $(TeamEmail)
TargetBranch: $(InsertTargetBranch)
InsertionPayloadName: $(InsertPayloadName)
# servicing branches until 17.12 also include Microsoft.Build.Engine and Microsoft.Build.Conversion.Core
${{ if or(eq(variables['Build.SourceBranchName'], 'vs17.0'), eq(variables['Build.SourceBranchName'], 'vs17.3'), eq(variables['Build.SourceBranchName'], 'vs17.6'), eq(variables['Build.SourceBranchName'], 'vs17.8'), eq(variables['Build.SourceBranchName'], 'vs17.10'), eq(variables['Build.SourceBranchName'], 'vs17.11'), eq(variables['Build.SourceBranchName'], 'vs17.12')) }}:
PackagePropsValues: VS.ExternalAPIs.MSBuild=$(MSBuild_ExtApisPackageVersion);Microsoft.Build=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Conversion.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Engine=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Framework=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Tasks.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Utilities.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.NET.StringTools=$(MicrosoftNETStringToolsPackageVersion)
${{ else }}:
PackagePropsValues: VS.ExternalAPIs.MSBuild=$(MSBuild_ExtApisPackageVersion);Microsoft.Build=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Framework=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Tasks.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.Build.Utilities.Core=$(MicrosoftNETStringToolsPackageVersion);Microsoft.NET.StringTools=$(MicrosoftNETStringToolsPackageVersion)
PackagePropsValues: $(InsertPackagePropsValues)
InsertionDescription: $(InsertDescription)
ComponentJsonValues: $(InsertJsonValues)
DefaultConfigValues: $(InsertConfigValues)
Expand Down
5 changes: 3 additions & 2 deletions documentation/release-checklist.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
## At release time
Before starting the process:
- [ ] If the release is being cut more than a few days before the VS-side snap, run insertions manually OR redirect MSBuild release branch
- [ ] Disabling automated run of [MSBuild VS Insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) (our {{NEXT_VERSION}} builds don't have a place to go in VS yet) is done by: Edit -> ... -> Triggers -> add a schedule on a dead branch (this overrides the YAML defined once-per-day schedule). Manual pipeline run: select as input resource the inserted "MSBuild" pipeline run on branch `vs{{THIS_RELEASE_VERSION}}` and VS TargetBranch `main`.
- [ ] Disable scheduled run of [MSBuild VS Insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) (our {{NEXT_VERSION}} builds don't have a place to go in VS yet) by: Edit -> ... -> Triggers -> add a schedule on a dead branch (this overrides the YAML defined once-per-day schedule for main). Manual pipeline run: select as input resource the to-be-inserted "MSBuild" pipeline run on branch `vs{{THIS_RELEASE_VERSION}}` and VS TargetBranch `main`.
OR
- [ ] If the release is being cut more than couple of weeks modify [YAML](https://github.com/dotnet/msbuild/tree/main/azure-pipelines/vs-insertion.yml) (and merge to affected MSBuild branches) of the [VS insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) so that it flows from MSBuild `vs{{THIS_RELEASE_VERSION}}` to VS `main` [in the MSBuild VS Insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) and keep scheduled insertions to simplify your workflow.
- [ ] If the release is being cut more than couple of weeks modify [YAML](https://github.com/dotnet/msbuild/tree/main/azure-pipelines/vs-insertion.yml) (and merge to affected MSBuild branches) of the [VS insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) so that it schedules insertions from MSBuild `vs{{THIS_RELEASE_VERSION}}` to VS `main`. Keep scheduled daily insertions to simplify your workflow and exclude `vs{{THIS_RELEASE_VERSION}}` from triggering insertion on each commit.

### Branching from main
- [ ] If the new version's branch was created before the Visual Studio fork: fast-forward merge the correct commit (the one that is currently inserted to VS main) to the `vs{{THIS_RELEASE_VERSION}}` branch \
Expand All @@ -28,6 +28,7 @@ _(This is for the case where we create the branch too early and want it to be ba
`dotnet pack MSBuild.Dev.slnf /p:ApiCompatGenerateSuppressionFile=true`.
- [ ] When VS main snaps to {{THIS_RELEASE_VERSION}} and updates its version to {{NEXT_VERSION}}, modify the [MSBuild VS Insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) YAML so that it flows from MSBuild main to VS main.
- [ ] Update AutoTargetBranch selection in the [YAML](https://github.com/dotnet/msbuild/tree/main/azure-pipelines/vs-insertion.yml) (add to parameters and make new AutoTargetBranch rule by copying it from existing ones) of the [MSBuild VS Insertion pipeline](https://devdiv.visualstudio.com/DevDiv/_build?definitionId=24295) to insert MSBuild `vs{{THIS_RELEASE_VERSION}}` to the corresponding VS branch `rel/d{{THIS_RELEASE_VERSION}}`.
- [ ] Set scheduled insertion for main and remove exclusion of `vs{{THIS_RELEASE_VERSION}}` triggering on each commit if added earlier.
- [ ] Merge {{NEXT_VERSION}} branding PR

### Adjust DARC channels and subscriptions
Expand Down
26 changes: 23 additions & 3 deletions documentation/specs/BuildCheck/Codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ Report codes are chosen to conform to suggested guidelines. Those guidelines are

| Diagnostic Code | Default Severity | Default Scope | Available from SDK | Reason |
|:-----|-------|-------|-------|----------|
| [BC0101](#bc0101---shared-output-path) | Warning | Project | 9.0.100 | Shared output path. |
| [BC0102](#bc0102---double-writes) | Warning | Project | 9.0.100 | Double writes. |
| [BC0101](#bc0101---shared-output-path) | Warning | N/A | 9.0.100 | Shared output path. |
| [BC0102](#bc0102---double-writes) | Warning | N/A | 9.0.100 | Double writes. |
| [BC0103](#bc0103---used-environment-variable) | Suggestion | Project | 9.0.100 | Used environment variable. |
| [BC0104](#bc0104---projectreference-is-preferred-to-reference) | Warning | Project | 9.0.200 | ProjectReference is preferred to Reference. |
| [BC0104](#bc0104---projectreference-is-preferred-to-reference) | Warning | N/A | 9.0.200 | ProjectReference is preferred to Reference. |
| [BC0105](#bc0105---embeddedresource-should-specify-culture-metadata) | Warning | N/A | 9.0.200 | Culture specific EmbeddedResource should specify Culture metadata. |
| [BC0201](#bc0201---usage-of-undefined-property) | Warning | Project | 9.0.100 | Usage of undefined property. |
| [BC0202](#bc0202---property-first-declared-after-it-was-used) | Warning | Project | 9.0.100 | Property first declared after it was used. |
| [BC0203](#bc0203----property-declared-but-never-used) | Suggestion | Project | 9.0.100 | Property declared but never used. |


Note: What does the 'N/A' scope mean? The scope of checks are only applicable and configurable in cases where evaluation-time data are being used and the source of the data is determinable and available. Otherwise the scope of whole build is always checked.

To enable verbose logging in order to troubleshoot issue(s), enable [binary logging](https://github.com/dotnet/msbuild/blob/main/documentation/wiki/Binary-Log.md#msbuild-binary-log-overview)

_Cmd:_
Expand Down Expand Up @@ -58,6 +61,23 @@ It is not recommended to reference project outputs. Such practice leads to losin

If you need to achieve more advanced dependency behavior - check [Controlling Dependencies Behavior](https://github.com/dotnet/msbuild/blob/main/documentation/wiki/Controlling-Dependencies-Behavior.md) document. If neither suits your needs - then you might need to disable this check for your build or for particular projects.

<a name="BC0105"></a>
## BC0105 - EmbeddedResource should specify Culture metadata.

"It is recommended to specify explicit 'Culture' metadata, or 'WithCulture=false' metadata with 'EmbeddedResource' item in order to avoid wrong or nondeterministic culture estimation."

[`EmbeddedResource` item](https://learn.microsoft.com/en-us/visualstudio/msbuild/common-msbuild-project-items#embeddedresource) has a `Culture` and `WithCulture` metadata that are strongly recommended to be used - to prevent MSBuild to need to 'guess' the culture from the file extension - which may be dependent on the current OS/Runtime available cultures and hence it can lead to nondeterministic build.

Examples:
* `<EmbeddedResource Update = "Resource1.xyz.resx" Culture="xyz" />` This indicates the culture to the MSBuild engine and the culture will be respected. No diagnostic (warning) is issued ([see below for exceptions](#RespectAlreadyAssignedItemCulture)).
* `<EmbeddedResource Update = "Resource1.xyz.resx" WithCulture="false" />` This indicates to the MSBuild engine that the file is culture neutral and the extension should not be treated as culture indicator. No diagnostic (warning) is issued.
* `<EmbeddedResource Update = "Resource1.xyz.resx" />` MSBuild infers the culture from the extra extension ('xyz') and if it is known to [`System.Globalization.CultureInfo`](https://learn.microsoft.com/en-us/dotnet/api/system.globalization.cultureinfo) it is being used as the resource culture. The `BC0105` diagnostic is emitted (if BuildCheck is enabled and BC0105 is not disabled)
* `<EmbeddedResource Update = "Resource1.resx" />` MSBuild infers that the resource is culture neutral. No diagnostic (warning) is issued.

<a name="RespectAlreadyAssignedItemCulture"></a>
**Note:** In Full Framework version of MSBuild (msbuild.exe, Visual Studio) and in .NET SDK prior 9.0 a global or project specific property `RespectAlreadyAssignedItemCulture` needs to be set to `'true'` in order for the explicit `Culture` metadata to be respected. Otherwise the explicit culture will be overwritten by MSBuild engine and if different from the extension - a `MSB3002` warning is emitted (`"MSB3002: Explicitly set culture "{0}" for item "{1}" was overwritten with inferred culture "{2}", because 'RespectAlreadyAssignedItemCulture' property was not set."`)


<a name="BC0201"></a>
## BC0201 - Usage of undefined property.

Expand Down
1 change: 1 addition & 0 deletions documentation/wiki/ChangeWaves.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ A wave of features is set to "rotate out" (i.e. become standard functionality) t

### 17.14
- [.SLNX support - use the new parser for .sln and .slnx](https://github.com/dotnet/msbuild/pull/10836)
- [Support custom culture in RAR](https://github.com/dotnet/msbuild/pull/11000)

### 17.12
- [Log TaskParameterEvent for scalar parameters](https://github.com/dotnet/msbuild/pull/9908)
Expand Down
8 changes: 4 additions & 4 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@
<Uri>https://github.com/nuget/nuget.client</Uri>
<Sha>c0d3837b40a353b5178cd02953db2924aacb8712</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-2.24561.1">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.13.0-3.24575.2">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>543cb4568f28b0d2f2cfecdf2d56365b9252e848</Sha>
<Sha>f86856dda7a9acbe86f2bbf356420596d9d72c23</Sha>
</Dependency>
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-2.24561.1">
<Dependency Name="Microsoft.SourceBuild.Intermediate.roslyn" Version="4.13.0-3.24575.2">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>543cb4568f28b0d2f2cfecdf2d56365b9252e848</Sha>
<Sha>f86856dda7a9acbe86f2bbf356420596d9d72c23</Sha>
<SourceBuild RepoName="roslyn" ManagedOnly="true" />
</Dependency>
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="9.0.0-beta.24562.13">
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<DotNetCliVersion>$([System.Text.RegularExpressions.Regex]::Match($([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)..\global.json')), '"dotnet": "([^"]*)"').Groups.get_Item(1))</DotNetCliVersion>
<MicrosoftCodeAnalysisCollectionsVersion>4.2.0-1.22102.8</MicrosoftCodeAnalysisCollectionsVersion>
<MicrosoftDotNetXUnitExtensionsVersion>9.0.0-beta.24562.13</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftNetCompilersToolsetVersion>4.13.0-2.24561.1</MicrosoftNetCompilersToolsetVersion>
<MicrosoftNetCompilersToolsetVersion>4.13.0-3.24575.2</MicrosoftNetCompilersToolsetVersion>
<NuGetBuildTasksVersion>6.13.0-preview.1.71</NuGetBuildTasksVersion>
</PropertyGroup>
<PropertyGroup Condition="!$(TargetFramework.StartsWith('net4'))">
Expand Down
Loading

0 comments on commit 00c89e9

Please sign in to comment.