Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into vs17.4
Browse files Browse the repository at this point in the history
  • Loading branch information
rainersigwald committed Sep 20, 2022
2 parents 7f3a30c + cc3db35 commit 6521b15
Show file tree
Hide file tree
Showing 27 changed files with 184 additions and 87 deletions.
5 changes: 4 additions & 1 deletion .vsts-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ variables:
- name: SourceBranch
value: $(IbcSourceBranchName)
# If we're not on a vs* branch, use main as our optprof collection branch
# NOTE: the code is temporarily fixed. For the branches that should use opt-prof from the main branch we should use the latest working Opt-Prof 20220901.6-001 collected from main 20220901.6.
- ${{ if not(startsWith(variables['Build.SourceBranch'], 'refs/heads/vs')) }}:
- name: OptProfDrop
value: 'OptimizationData/DotNet-msbuild-Trusted/main/20220901.6/1387996/1'
- name: SourceBranch
value: main
value: ''
# if OptProfDropName is set as a parameter, set OptProfDrop to the parameter and unset SourceBranch
- ${{ if ne(parameters.OptProfDropName, 'default') }}:
- name: OptProfDrop
Expand Down
16 changes: 15 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@

<PropertyGroup>
<FullFrameworkTFM>net472</FullFrameworkTFM>

<!--
When updating the version of .NET Core for MSBuild, this property is the 'source of truth'.
Other locations to update the version number:
global.json
eng/cibuild_bootstrapped_msbuild.ps1
eng/cibuild_bootstrapped_msbuild.sh
scripts/Deploy-MSBuild.ps1
src/Framework/README.md
src/Utilities/README.md
-->
<LatestDotNetCoreForMSBuild>net7.0</LatestDotNetCoreForMSBuild>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -36,9 +48,11 @@
CS1701 and CS1702 are by default ignored by Microsoft.NET.Sdk, but if you define the NoWarn property in Directory.Build.props,
you don't get those defaults.
SYSLIB0011: Removing binary formatter will happen as part of a larger .NET-wide effort.
SYSLIB0037 & SYSLIB0044: The deprecated AssemblyName members could require a bigger refactor for us: https://github.com/dotnet/msbuild/issues/7902
RS0016 & RS0017: Roslyn analyzers seem to be bugged, claiming that API's that exist don't and vise-versa: https://github.com/dotnet/msbuild/issues/7903
-->

<NoWarn>$(NoWarn);NU1603;NU5105;1701;1702;SYSLIB0011</NoWarn>
<NoWarn>$(NoWarn);NU1603;NU5105;1701;1702;SYSLIB0011;SYSLIB0037;SYSLIB0044;RS0016;RS0017;</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug-MONO'">
Expand Down
2 changes: 1 addition & 1 deletion eng/BootStrapMSBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
Copy it from "next to MSBuild" in the pre-bootstrap SDK to our little weirdo bootstrap
layout next to the SDK tasks, so it can get loaded by the SDK tasks that need it. -->
<Copy SourceFiles="$(DOTNET_INSTALL_DIR)\sdk\$(DotNetCliVersion)\Microsoft.Extensions.DependencyModel.dll"
DestinationFolder="$(BootstrapDestination)Sdks\Microsoft.NET.Sdk\tools\net6.0" />
DestinationFolder="$(BootstrapDestination)Sdks\Microsoft.NET.Sdk\tools\$(LatestDotNetCoreForMSBuild)" />

<Copy SourceFiles="@(InstalledExtensions)"
DestinationFolder="$(BootstrapDestination)Current\%(RecursiveDir)" />
Expand Down
16 changes: 8 additions & 8 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22457.3">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="6.0.0-beta.22458.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>60eeccda4868d869c5995a5b68a6e47926b4342d</Sha>
<Sha>6812704fe5a1baead5da5c1c8bf723752ab728b5</Sha>
<SourceBuild RepoName="arcade" ManagedOnly="true" />
</Dependency>
<Dependency Name="NuGet.Build.Tasks" Version="6.2.0-rc.146">
<Dependency Name="NuGet.Build.Tasks" Version="6.4.0-preview.3.74">
<Uri>https://github.com/nuget/nuget.client</Uri>
<Sha>b8a61266d9a6780cb7eb9c1942695cf813fdef0a</Sha>
<Sha>d22c6743bf6237c39b98d5d680e06e6c33e97f1c</Sha>
</Dependency>
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.4.0-2.22451.9">
<Dependency Name="Microsoft.Net.Compilers.Toolset" Version="4.4.0-2.22458.3">
<Uri>https://github.com/dotnet/roslyn</Uri>
<Sha>c359ad156990845a93f607267292675ab92786a9</Sha>
<Sha>85f9dbfea5955ec9cdad3417dba40034da74fb93</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="6.0.0-beta.22457.3">
<Dependency Name="Microsoft.DotNet.XUnitExtensions" Version="6.0.0-beta.22458.2">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>60eeccda4868d869c5995a5b68a6e47926b4342d</Sha>
<Sha>6812704fe5a1baead5da5c1c8bf723752ab728b5</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
8 changes: 4 additions & 4 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the MIT license. See License.txt in the project root for full license information. -->
<Project>
<PropertyGroup>
<VersionPrefix>17.4.1</VersionPrefix>
<VersionPrefix>17.4.0</VersionPrefix>
<AssemblyVersion>15.1.0.0</AssemblyVersion>
<PreReleaseVersionLabel>preview</PreReleaseVersionLabel>
<DotNetUseShippingVersions>true</DotNetUseShippingVersions>
Expand Down Expand Up @@ -42,11 +42,11 @@
Otherwise, this version of dotnet will not be installed and the build will error out. -->
<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>6.0.0-beta.22457.3</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftDotNetXUnitExtensionsVersion>6.0.0-beta.22458.2</MicrosoftDotNetXUnitExtensionsVersion>
<MicrosoftExtensionsDependencyModelVersion>6.0.0-preview.2.21154.6</MicrosoftExtensionsDependencyModelVersion>
<MicrosoftIORedistVersion>6.0.0</MicrosoftIORedistVersion>
<MicrosoftNetCompilersToolsetVersion>4.4.0-2.22451.9</MicrosoftNetCompilersToolsetVersion>
<NuGetBuildTasksVersion>6.2.0-rc.146</NuGetBuildTasksVersion>
<MicrosoftNetCompilersToolsetVersion>4.4.0-2.22458.3</MicrosoftNetCompilersToolsetVersion>
<NuGetBuildTasksVersion>6.4.0-preview.3.74</NuGetBuildTasksVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.0.0</SystemRuntimeCompilerServicesUnsafeVersion>
<SystemTextJsonVersion>6.0.0</SystemTextJsonVersion>
<SystemThreadingTasksDataflowVersion>6.0.0</SystemThreadingTasksDataflowVersion>
Expand Down
2 changes: 1 addition & 1 deletion eng/cibuild_bootstrapped_msbuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ try {
else
{
$buildToolPath = $dotnetExePath
$buildToolCommand = Join-Path $bootstrapRoot "net6.0\MSBuild\MSBuild.dll"
$buildToolCommand = Join-Path $bootstrapRoot "net7.0\MSBuild\MSBuild.dll"
$buildToolFramework = "netcoreapp3.1"
}

Expand Down
2 changes: 1 addition & 1 deletion eng/cibuild_bootstrapped_msbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ bootstrapRoot="$Stage1Dir/bin/bootstrap"
if [ $host_type = "core" ]
then
_InitializeBuildTool="$_InitializeDotNetCli/dotnet"
_InitializeBuildToolCommand="$bootstrapRoot/net6.0/MSBuild/MSBuild.dll"
_InitializeBuildToolCommand="$bootstrapRoot/net7.0/MSBuild/MSBuild.dll"
_InitializeBuildToolFramework="netcoreapp3.1"
elif [ $host_type = "mono" ]
then
Expand Down
9 changes: 5 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"allowPrerelease": true
},
"tools": {
"dotnet": "6.0.200",
"dotnet": "7.0.100-rc.1.22431.12",
"vs": {
"version": "17.0"
}
"version": "17.2.1"
},
"xcopy-msbuild": "17.2.1"
},
"msbuild-sdks": {
"Microsoft.Build.CentralPackageVersions": "2.0.1",
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22457.3"
"Microsoft.DotNet.Arcade.Sdk": "6.0.0-beta.22458.2"
}
}
2 changes: 1 addition & 1 deletion scripts/Deploy-MSBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ else {
if ($runtime -eq "Desktop") {
$targetFramework = "net472"
} else {
$targetFramework = "net6.0"
$targetFramework = "net7.0"
}

$bootstrapBinDirectory = "artifacts\bin\MSBuild.Bootstrap\$configuration\$targetFramework"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,32 +85,32 @@ public static IList<RMock> ExportCollection<T, RMock>(this ProjectCollectionLink
}


public static IDictionary<key, T> ImportDictionary<key, T, RMock>(this ProjectCollectionLinker importer, IDictionary<key, RMock> source)
where T : class
where RMock : MockLinkRemoter<T>, new()
public static IDictionary<TKey, TValue> ImportDictionary<TKey, TValue, RMock>(this ProjectCollectionLinker importer, IDictionary<TKey, RMock> source)
where TValue : class
where RMock : MockLinkRemoter<TValue>, new()
{
if (source == null) return null;
// Just copy ...
Dictionary<key, T> result = new Dictionary<key, T>();
Dictionary<TKey, TValue> result = new Dictionary<TKey, TValue>();
foreach (var sRemoter in source)
{
var value = importer.Import<T, RMock>(sRemoter.Value);
var value = importer.Import<TValue, RMock>(sRemoter.Value);
result.Add(sRemoter.Key, value);
}

return result;
}

public static IDictionary<key, RMock> ExportDictionary<key, T, RMock>(this ProjectCollectionLinker exporter, IDictionary<key, T> source)
where T : class
where RMock : MockLinkRemoter<T>, new()
public static IDictionary<TKey, RMock> ExportDictionary<TKey, TValue, RMock>(this ProjectCollectionLinker exporter, IDictionary<TKey, TValue> source)
where TValue : class
where RMock : MockLinkRemoter<TValue>, new()
{
if (source == null) return null;
// Just copy ...
Dictionary<key, RMock> result = new Dictionary<key, RMock>();
Dictionary<TKey, RMock> result = new Dictionary<TKey, RMock>();
foreach (var s in source)
{
var valueRemoter = exporter.Export<T, RMock>(s.Value);
var valueRemoter = exporter.Export<TValue, RMock>(s.Value);
result.Add(s.Key, valueRemoter);
}

Expand Down
4 changes: 2 additions & 2 deletions src/Build.UnitTests/Microsoft.Build.Engine.UnitTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@
<ProjectReference Include="..\Samples\TaskWithDependency\TaskWithDependency.csproj" Private="false" ReferenceOutputAssembly="false" OutputItemType="TaskWithDependencyResolvedProjectReferencePath">
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(MonoBuild)' == 'true'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">TargetFramework=net6.0</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">TargetFramework=$(LatestDotNetCoreForMSBuild)</SetTargetFramework>
</ProjectReference>
<ProjectReference Include="..\Samples\PortableTask\PortableTask.csproj" Private="false" ReferenceOutputAssembly="false" OutputItemType="PortableTaskResolvedProjectReferencePath" />

<ProjectReference Include="..\Samples\ProjectCachePlugin\ProjectCachePlugin.csproj" Private="false" ReferenceOutputAssembly="false">
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' and '$(MonoBuild)' == 'true'">TargetFramework=$(FullFrameworkTFM)</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">TargetFramework=net6.0</SetTargetFramework>
<SetTargetFramework Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">TargetFramework=$(LatestDotNetCoreForMSBuild)</SetTargetFramework>
</ProjectReference>
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/Build/Definition/ToolsetReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Microsoft.Build.Framework;
using Microsoft.Build.Internal;
using Microsoft.Build.Shared.FileSystem;
using error = Microsoft.Build.Shared.ErrorUtilities;
using ErrorUtils = Microsoft.Build.Shared.ErrorUtilities;
using InvalidProjectFileException = Microsoft.Build.Exceptions.InvalidProjectFileException;
using InvalidToolsetDefinitionException = Microsoft.Build.Exceptions.InvalidToolsetDefinitionException;
using ReservedPropertyNames = Microsoft.Build.Internal.ReservedPropertyNames;
Expand Down Expand Up @@ -366,7 +366,7 @@ internal string ReadToolsets
out string defaultOverrideToolsVersion
)
{
error.VerifyThrowArgumentNull(toolsets, "Toolsets");
ErrorUtils.VerifyThrowArgumentNull(toolsets, "Toolsets");

ReadEachToolset(toolsets, globalProperties, initialProperties, accumulateProperties);

Expand Down
53 changes: 26 additions & 27 deletions src/Build/Evaluation/Evaluator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1734,8 +1734,7 @@ private void ExpandAndLoadImportsFromUnescapedImportExpressionConditioned(
string directoryOfImportingFile,
ProjectImportElement importElement,
out List<ProjectRootElement> projects,
out SdkResult sdkResult,
bool throwOnFileNotExistsError = true)
out SdkResult sdkResult)
{
projects = null;
sdkResult = null;
Expand Down Expand Up @@ -1874,7 +1873,7 @@ static string EvaluateProperty(string value, IElementLocation location,
if (sdkResult.Path != null)
{
ExpandAndLoadImportsFromUnescapedImportExpression(directoryOfImportingFile, importElement, Path.Combine(sdkResult.Path, project),
throwOnFileNotExistsError, out projects);
throwOnFileNotExistsError: true, out projects);

if (projects?.Count > 0)
{
Expand All @@ -1887,7 +1886,7 @@ static string EvaluateProperty(string value, IElementLocation location,
foreach (var additionalPath in sdkResult.AdditionalPaths)
{
ExpandAndLoadImportsFromUnescapedImportExpression(directoryOfImportingFile, importElement, Path.Combine(additionalPath, project),
throwOnFileNotExistsError, out var additionalProjects);
throwOnFileNotExistsError: true, out var additionalProjects);

if (additionalProjects?.Count > 0)
{
Expand All @@ -1913,7 +1912,7 @@ static string EvaluateProperty(string value, IElementLocation location,
else
{
ExpandAndLoadImportsFromUnescapedImportExpression(directoryOfImportingFile, importElement, project,
throwOnFileNotExistsError, out projects);
throwOnFileNotExistsError: true, out projects);
}
}

Expand Down Expand Up @@ -2256,31 +2255,31 @@ private LoadImportsResult ExpandAndLoadImportsFromUnescapedImportExpression(stri
// There's a specific message for file not existing
if (!FileSystems.Default.FileExists(importFileUnescaped))
{
bool ignoreMissingImportsFlagSet = (_loadSettings & ProjectLoadSettings.IgnoreMissingImports) != 0;
if (!throwOnFileNotExistsError || ignoreMissingImportsFlagSet)
if ((_loadSettings & ProjectLoadSettings.IgnoreMissingImports) != 0)
{
if (ignoreMissingImportsFlagSet)
// Log message for import skipped
ProjectImportedEventArgs eventArgs = new ProjectImportedEventArgs(
importElement.Location.Line,
importElement.Location.Column,
ProjectImportSkippedMissingFile,
importFileUnescaped,
importElement.ContainingProject.FullPath,
importElement.Location.Line,
importElement.Location.Column)
{
// Log message for import skipped
ProjectImportedEventArgs eventArgs = new ProjectImportedEventArgs(
importElement.Location.Line,
importElement.Location.Column,
ProjectImportSkippedMissingFile,
importFileUnescaped,
importElement.ContainingProject.FullPath,
importElement.Location.Line,
importElement.Location.Column)
{
BuildEventContext = _evaluationLoggingContext.BuildEventContext,
UnexpandedProject = importElement.Project,
ProjectFile = importElement.ContainingProject.FullPath,
ImportedProjectFile = importFileUnescaped,
ImportIgnored = true,
};

_evaluationLoggingContext.LogBuildEvent(eventArgs);
}
BuildEventContext = _evaluationLoggingContext.BuildEventContext,
UnexpandedProject = importElement.Project,
ProjectFile = importElement.ContainingProject.FullPath,
ImportedProjectFile = importFileUnescaped,
ImportIgnored = true,
};

_evaluationLoggingContext.LogBuildEvent(eventArgs);

continue;
}
else if (!throwOnFileNotExistsError)
{
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Build/Microsoft.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Import Project="..\Shared\DebuggingSources.proj" />

<PropertyGroup>
<TargetFrameworks>$(FullFrameworkTFM);net6.0</TargetFrameworks>
<TargetFrameworks>$(FullFrameworkTFM);$(LatestDotNetCoreForMSBuild)</TargetFrameworks>
<TargetFrameworks Condition="'$(MonoBuild)'=='true'">$(RuntimeOutputTargetFrameworks)</TargetFrameworks>
<RootNamespace>Microsoft.Build</RootNamespace>
<AssemblyName>Microsoft.Build</AssemblyName>
Expand Down
3 changes: 2 additions & 1 deletion src/Directory.BeforeCommon.targets
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<DefineConstants Condition="'$(MonoBuild)' != 'true'">$(DefineConstants);FEATURE_COMPILE_IN_TESTS</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CONSTRAINED_EXECUTION</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CODETASKFACTORY</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CRYPTOGRAPHIC_FACTORY_ALGORITHM_NAMES</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_CULTUREINFO_GETCULTURES</DefineConstants>
<DefineConstants Condition="'$(MonoBuild)' != 'true' and '$(MachineIndependentBuild)' != 'true'">$(DefineConstants);FEATURE_ENCODING_DEFAULT</DefineConstants>
<DefineConstants>$(DefineConstants);FEATURE_ENVIRONMENT_SYSTEMDIRECTORY</DefineConstants>
Expand Down Expand Up @@ -93,7 +94,7 @@
<DefineConstants>$(DefineConstants);FEATURE_SYMLINK_TARGET</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == 'net6.0'">
<PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1' or '$(TargetFramework)' == '$(LatestDotNetCoreForMSBuild)'">
<DefineConstants>$(DefineConstants);FEATURE_PIPEOPTIONS_CURRENTUSERONLY</DefineConstants>
<DefineConstants Condition="'$(MachineIndependentBuild)' != 'true'">$(DefineConstants);FEATURE_NODE_REUSE</DefineConstants>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 6521b15

Please sign in to comment.