Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions eng/BootStrapMsBuild.targets
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,4 @@

</Target>

<Import Project=".\TestAssets.targets" />

</Project>
37 changes: 0 additions & 37 deletions eng/TestAssets.targets

This file was deleted.

1 change: 1 addition & 0 deletions src/Build/Microsoft.Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<IncludeSatelliteOutputInPack>false</IncludeSatelliteOutputInPack>
<ApplyNgenOptimization Condition="'$(TargetFramework)' == '$(FullFrameworkTFM)'">full</ApplyNgenOptimization>
<EnablePackageValidation>true</EnablePackageValidation>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>

<!-- Do not generate a warning that our 'stable' package should not have a prerelease dependency. -->
<NoWarn>$(NoWarn);NU5104</NoWarn>
Expand Down
14 changes: 0 additions & 14 deletions src/BuildCheck.UnitTests/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/BuildCheck.UnitTests/DoubleWritesAnalyzer_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public DoubleWritesCheck_Tests()

private TaskInvocationCheckData MakeTaskInvocationData(string taskName, Dictionary<string, TaskInvocationCheckData.TaskParameter> parameters)
{
string projectFile = NativeMethodsShared.IsWindows ? @"C:\fake\project.proj" : "/fake/project.proj";
string projectFile = Framework.NativeMethods.IsWindows ? @"C:\fake\project.proj" : "/fake/project.proj";
return new TaskInvocationCheckData(
projectFile,
null,
Expand Down
15 changes: 9 additions & 6 deletions src/BuildCheck.UnitTests/EndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ public void EditorConfig_SeverityAppliedCorrectly(string BC0101Severity, string?
}
}

[Fact(Skip = "To unblock: https://github.com/dotnet/msbuild/issues/11090")]
[Fact]
public void CheckHasAccessToAllConfigs()
{
using (var env = TestEnvironment.Create())
Expand Down Expand Up @@ -757,7 +757,7 @@ public void NoEnvironmentVariableProperty_DeferredProcessing(bool warnAsError, b
}
}

[Theory(Skip = "To unblock: https://github.com/dotnet/msbuild/issues/11090")]
[Theory]
[InlineData("CheckCandidate", new[] { "CustomRule1", "CustomRule2" })]
[InlineData("CheckCandidateWithMultipleChecksInjected", new[] { "CustomRule1", "CustomRule2", "CustomRule3" }, true)]
public void CustomCheckTest_NoEditorConfig(string checkCandidate, string[] expectedRegisteredRules, bool expectedRejectedChecks = false)
Expand Down Expand Up @@ -790,7 +790,7 @@ public void CustomCheckTest_NoEditorConfig(string checkCandidate, string[] expec
}
}

[Theory(Skip = "To unblock: https://github.com/dotnet/msbuild/issues/11090")]
[Theory]
[InlineData("CheckCandidate", "X01234", "error", "error X01234: http://samplelink.com/X01234")]
[InlineData("CheckCandidateWithMultipleChecksInjected", "X01234", "warning", "warning X01234: http://samplelink.com/X01234")]
public void CustomCheckTest_WithEditorConfig(string checkCandidate, string ruleId, string severity, string expectedMessage)
Expand All @@ -817,7 +817,7 @@ public void CustomCheckTest_WithEditorConfig(string checkCandidate, string ruleI
}
}

[Theory(Skip = "To unblock: https://github.com/dotnet/msbuild/issues/11090")]
[Theory]
[InlineData("X01236", "ErrorOnInitializeCheck", "Something went wrong initializing")]
[InlineData("X01237", "ErrorOnRegisteredAction", "something went wrong when executing registered action")]
[InlineData("X01238", "ErrorWhenRegisteringActions", "something went wrong when registering actions")]
Expand Down Expand Up @@ -867,7 +867,7 @@ public void DoesNotRunOnRestore(bool buildInOutOfProcessNode)
}

#if NET
[Fact(Skip = "To unblock: https://github.com/dotnet/msbuild/issues/11090")]
[Fact]
public void TestBuildCheckTemplate()
{
TransientTestFolder workFolder = _env.CreateFolder(createFolder: true);
Expand Down Expand Up @@ -907,7 +907,10 @@ private void AddCustomDataSourceToNugetConfig(string checkCandidatePath)

// The test packages are generated during the test project build and saved in CustomChecks folder.
string checksPackagesPath = Path.Combine(Directory.GetParent(AssemblyLocation)?.Parent?.FullName ?? string.Empty, "CustomChecks");
AddPackageSource(doc, packageSourcesNode, "Key", checksPackagesPath);
AddPackageSource(doc, packageSourcesNode, "CustomCheckSource", checksPackagesPath);

// MSBuild packages are placed in a separate folder, so we need to add it as a package source.
AddPackageSource(doc, packageSourcesNode, "MSBuildTestPackagesSource", RunnerUtilities.ArtifactsLocationAttribute.ArtifactsLocation);

doc.Save(Path.Combine(checkCandidatePath, "nuget.config"));
}
Expand Down
12 changes: 6 additions & 6 deletions src/BuildCheck.UnitTests/SharedOutputPathCheck_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private EvaluatedPropertiesCheckData MakeEvaluatedPropertiesAction(
public void TestTwoProjectsWithSameRelativeOutputPath()
{
// Full output and intermediate paths are different: "C:/fake1/bin/Debug" and "C:/fake1/obj/Debug".
string projectFile1 = NativeMethodsShared.IsWindows ? "C:\\fake1\\project1.proj" : "/fake1/project1.proj";
string projectFile1 = Framework.NativeMethods.IsWindows ? "C:\\fake1\\project1.proj" : "/fake1/project1.proj";
_registrationContext.TriggerEvaluatedPropertiesAction(MakeEvaluatedPropertiesAction(
projectFile1,
new Dictionary<string, string> {
Expand All @@ -48,7 +48,7 @@ public void TestTwoProjectsWithSameRelativeOutputPath()
null));

// Full output and intermediate paths are different: "C:/fake2/bin/Debug" and "C:/fake2/obj/Debug".
string projectFile2 = NativeMethodsShared.IsWindows ? "C:\\fake2\\project2.proj" : "/fake2/project2.proj";
string projectFile2 = Framework.NativeMethods.IsWindows ? "C:\\fake2\\project2.proj" : "/fake2/project2.proj";
_registrationContext.TriggerEvaluatedPropertiesAction(MakeEvaluatedPropertiesAction(
projectFile2,
new Dictionary<string, string> {
Expand All @@ -65,8 +65,8 @@ public void TestTwoProjectsWithSameRelativeOutputPath()
public void TestProjectsWithDifferentPathsSeparators()
{
// Paths separators are messed up.
string projectFile1 = NativeMethodsShared.IsWindows ? "C:\\fake\\project1.proj" : "/fake/project1.proj";
string projectFile2 = NativeMethodsShared.IsWindows ? "C:\\fake\\project2.proj" : "/fake/project2.proj";
string projectFile1 = Framework.NativeMethods.IsWindows ? "C:\\fake\\project1.proj" : "/fake/project1.proj";
string projectFile2 = Framework.NativeMethods.IsWindows ? "C:\\fake\\project2.proj" : "/fake/project2.proj";

_registrationContext.TriggerEvaluatedPropertiesAction(MakeEvaluatedPropertiesAction(
projectFile1,
Expand All @@ -90,7 +90,7 @@ public void TestProjectsWithDifferentPathsSeparators()
_registrationContext.Results[1].CheckRule.Id.ShouldBe("BC0101");

// Check that paths are formed with correct paths separators
string wrongPathSeparator = NativeMethodsShared.IsWindows ? "/" : "\\";
string wrongPathSeparator = Framework.NativeMethods.IsWindows ? "/" : "\\";

foreach (string path in _registrationContext.Results[0].MessageArgs)
{
Expand All @@ -105,7 +105,7 @@ public void TestProjectsWithDifferentPathsSeparators()
[Fact]
public void TestThreeProjectsWithSameOutputPath()
{
string projectFolder = NativeMethodsShared.IsWindows ? "C:\\fake\\" : "/fake/";
string projectFolder = Framework.NativeMethods.IsWindows ? "C:\\fake\\" : "/fake/";
string projectFile1 = $"{projectFolder}project1.proj";
string projectFile2 = $"{projectFolder}project2.proj";
string projectFile3 = $"{projectFolder}project3.proj";
Expand Down
2 changes: 0 additions & 2 deletions src/BuildCheck.UnitTests/TestAssets/Common/CommonTest.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
<_PackagesToPack Remove="@(_PackagesToPack)" Condition="'%(_PackagesToPack.IncludeInPackage)' != 'true'" />
</ItemGroup>

<Message Importance="High" Text="Adding DLLs from the following packages: @(_PackagesToPack->'%(NuGetPackageId)')" />

<ItemGroup>
<!-- Update the collection of items to pack with the DLLs from the NuGet packages -->
<None Include="@(_PackagesToPack)" Pack="true" PackagePath="build" Visible="false" />
Expand Down
1 change: 1 addition & 0 deletions src/Framework/Microsoft.Build.Framework.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<IncludeSatelliteOutputInPack>false</IncludeSatelliteOutputInPack>
<ApplyNgenOptimization Condition="'$(TargetFramework)' == '$(FullFrameworkTFM)'">full</ApplyNgenOptimization>
<EnablePackageValidation>true</EnablePackageValidation>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 2 additions & 0 deletions src/StringTools/StringTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

<EnablePackageValidation>true</EnablePackageValidation>

<GeneratePackageOnBuild>True</GeneratePackageOnBuild>

<AssemblyName>Microsoft.NET.StringTools</AssemblyName>
<PackageDescription>This package contains the $(AssemblyName) assembly which implements common string-related functionality such as weak interning.</PackageDescription>

Expand Down
10 changes: 10 additions & 0 deletions src/UnitTests.Shared/ArtifactsLocationAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Microsoft.Build.UnitTests.Shared;

[System.AttributeUsage(System.AttributeTargets.Assembly)]
public sealed class ArtifactsLocationAttribute(string artifactsLocation) : System.Attribute
{
public string ArtifactsLocation { get; } = artifactsLocation;
}
5 changes: 5 additions & 0 deletions src/UnitTests.Shared/Microsoft.Build.UnitTests.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,10 @@
<_Parameter1>$(TestBootstrapBinaryDestination)</_Parameter1>
<_Parameter2>$(BootstrapSdkVersion)</_Parameter2>
</AssemblyAttribute>

<AssemblyAttribute Include="Microsoft.Build.UnitTests.Shared.ArtifactsLocationAttribute">
<_Parameter1>$(ArtifactsShippingPackagesDir)</_Parameter1>
</AssemblyAttribute>

</ItemGroup>
</Project>
3 changes: 3 additions & 0 deletions src/UnitTests.Shared/RunnerUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ namespace Microsoft.Build.UnitTests.Shared
public static class RunnerUtilities
{
public static string PathToCurrentlyRunningMsBuildExe => BuildEnvironmentHelper.Instance.CurrentMSBuildExePath;

public static ArtifactsLocationAttribute ArtifactsLocationAttribute = Assembly.GetExecutingAssembly().GetCustomAttribute<ArtifactsLocationAttribute>()
?? throw new InvalidOperationException("This test assembly does not have the ArtifactsLocationAttribute");
#if !FEATURE_RUN_EXE_IN_TESTS
private static readonly string s_dotnetExePath = EnvironmentProvider.GetDotnetExePath();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@
<_PackagesToPack Remove="@(_PackagesToPack)" Condition="'%(_PackagesToPack.IncludeInPackage)' != 'true'" />
</ItemGroup>

<Message Importance="High" Text="Adding DLLs from the following packages: @(_PackagesToPack->'%(NuGetPackageId)')" />

<ItemGroup>
<!-- Update the collection of items to pack with the DLLs from the NuGet packages -->
<None Include="@(_PackagesToPack)" Pack="true" PackagePath="build" Visible="false" />
Expand Down