diff --git a/src/Assets/DesktopTestProjects/MultiTFMXunitProject/XUnitProject/XUnitProject.csproj b/src/Assets/DesktopTestProjects/MultiTFMXunitProject/XUnitProject/XUnitProject.csproj
index 89d04fdbdb84..a2cf306a20c4 100644
--- a/src/Assets/DesktopTestProjects/MultiTFMXunitProject/XUnitProject/XUnitProject.csproj
+++ b/src/Assets/DesktopTestProjects/MultiTFMXunitProject/XUnitProject/XUnitProject.csproj
@@ -2,7 +2,7 @@
- net462;netcoreapp3.1
+ net462;$(CurrentTargetFramework)
diff --git a/src/Assets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/MultiTFMTestApp/MultiTFMTestApp.csproj b/src/Assets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/MultiTFMTestApp/MultiTFMTestApp.csproj
index 9033e898165a..b1456d4d8a94 100644
--- a/src/Assets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/MultiTFMTestApp/MultiTFMTestApp.csproj
+++ b/src/Assets/DesktopTestProjects/NETFrameworkReferenceNETStandard20/MultiTFMTestApp/MultiTFMTestApp.csproj
@@ -2,7 +2,7 @@
Exe
- netcoreapp3.1;net462
+ $(CurrentTargetFramework);net462
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs
index 31b3bee2408c..a0b6f088b5df 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks.UnitTests/GivenADependencyContextBuilder.cs
@@ -40,6 +40,7 @@ public void ItBuildsDependencyContextsFromProjectLockFiles(
object[] resolvedNuGetFiles)
{
LockFile lockFile = TestLockFiles.GetLockFile(mainProjectName);
+ LockFileLookup lockFileLookup = new LockFileLookup(lockFile);
SingleProjectInfo mainProject = SingleProjectInfo.Create(
"/usr/Path",
@@ -52,8 +53,9 @@ public void ItBuildsDependencyContextsFromProjectLockFiles(
ReferenceInfo.CreateDirectReferenceInfos(
referencePaths ?? new ITaskItem[] { },
referenceSatellitePaths ?? new ITaskItem[] { },
- projectContextHasProjectReferences: false,
- i => true);
+ lockFileLookup: lockFileLookup,
+ i => true,
+ true);
ProjectContext projectContext = lockFile.CreateProjectContext(
FrameworkConstants.CommonFrameworks.NetCoreApp10.GetShortFolderName(),
@@ -67,7 +69,7 @@ public void ItBuildsDependencyContextsFromProjectLockFiles(
resolvedNuGetFiles = Array.Empty();
}
- DependencyContext dependencyContext = new DependencyContextBuilder(mainProject, includeRuntimeFileVersions: false, runtimeGraph: null, projectContext: projectContext)
+ DependencyContext dependencyContext = new DependencyContextBuilder(mainProject, includeRuntimeFileVersions: false, runtimeGraph: null, projectContext: projectContext, libraryLookup: lockFileLookup)
.WithDirectReferences(directReferences)
.WithCompilationOptions(compilationOptions)
.WithResolvedNuGetFiles((ResolvedFile[]) resolvedNuGetFiles)
@@ -264,7 +266,7 @@ private DependencyContext BuildDependencyContextWithReferenceAssemblies(bool use
useCompilationOptions ? CreateCompilationOptions() :
null;
- DependencyContext dependencyContext = new DependencyContextBuilder(mainProject, includeRuntimeFileVersions: false, runtimeGraph: null, projectContext: projectContext)
+ DependencyContext dependencyContext = new DependencyContextBuilder(mainProject, includeRuntimeFileVersions: false, runtimeGraph: null, projectContext: projectContext, libraryLookup: new LockFileLookup(lockFile))
.WithReferenceAssemblies(ReferenceInfo.CreateReferenceInfos(referencePaths))
.WithCompilationOptions(compilationOptions)
.Build();
@@ -325,7 +327,7 @@ public void ItCanGenerateTheRuntimeFallbackGraph()
void CheckRuntimeFallbacks(string runtimeIdentifier, int fallbackCount)
{
projectContext.LockFileTarget.RuntimeIdentifier = runtimeIdentifier;
- var dependencyContextBuilder = new DependencyContextBuilder(mainProject, includeRuntimeFileVersions: false, runtimeGraph, projectContext);
+ var dependencyContextBuilder = new DependencyContextBuilder(mainProject, includeRuntimeFileVersions: false, runtimeGraph, projectContext, libraryLookup: new LockFileLookup(lockFile));
var runtimeFallbacks = dependencyContextBuilder.Build().RuntimeGraph;
runtimeFallbacks
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder.cs b/src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder.cs
index 5428145aa35f..bbbaeb68ba98 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder.cs
@@ -47,14 +47,12 @@ internal class DependencyContextBuilder
private const string NetCorePlatformLibrary = "Microsoft.NETCore.App";
- public DependencyContextBuilder(SingleProjectInfo mainProjectInfo, bool includeRuntimeFileVersions, RuntimeGraph runtimeGraph, ProjectContext projectContext)
+ public DependencyContextBuilder(SingleProjectInfo mainProjectInfo, bool includeRuntimeFileVersions, RuntimeGraph runtimeGraph, ProjectContext projectContext, LockFileLookup libraryLookup)
{
_mainProjectInfo = mainProjectInfo;
_includeRuntimeFileVersions = includeRuntimeFileVersions;
_runtimeGraph = runtimeGraph;
- var libraryLookup = new LockFileLookup(projectContext.LockFile);
-
_dependencyLibraries = projectContext.LockFileTarget.Libraries
.Select(lockFileTargetLibrary =>
{
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs b/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs
index 67369ee412eb..dc71c6e3ac7b 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs
@@ -94,6 +94,8 @@ public class GenerateDepsFile : TaskWithAssemblyResolveHooks
public bool IncludeRuntimeFileVersions { get; set; }
+ public bool IncludeProjectsNotInAssetsFile { get; set; }
+
[Required]
public string RuntimeGraphPath { get; set; }
@@ -125,20 +127,19 @@ private Dictionary GetFilteredPackages()
private void WriteDepsFile(string depsFilePath)
{
- ProjectContext projectContext;
- if (AssetsFilePath == null)
- {
- projectContext = null;
- }
- else
+ ProjectContext projectContext = null;
+ LockFileLookup lockFileLookup = null;
+ if (AssetsFilePath != null)
{
LockFile lockFile = new LockFileCache(this).GetLockFile(AssetsFilePath);
projectContext = lockFile.CreateProjectContext(
- TargetFramework,
- RuntimeIdentifier,
- PlatformLibraryName,
- RuntimeFrameworks,
- IsSelfContained);
+ TargetFramework,
+ RuntimeIdentifier,
+ PlatformLibraryName,
+ RuntimeFrameworks,
+ IsSelfContained);
+
+ lockFileLookup = new LockFileLookup(lockFile);
}
CompilationOptions compilationOptions = CompilationOptionsConverter.ConvertFrom(CompilerOptions);
@@ -156,13 +157,15 @@ private void WriteDepsFile(string depsFilePath)
IEnumerable referenceAssemblyInfos =
ReferenceInfo.CreateReferenceInfos(ReferenceAssemblies);
- // If there is a generated asset file. The projectContext will have project reference.
- // So remove it from directReferences to avoid duplication
- var projectContextHasProjectReferences = projectContext != null;
+ // If there is a generated asset file, the projectContext will contain most of the project references.
+ // So remove any project reference contained within projectContext from directReferences to avoid duplication
IEnumerable directReferences =
- ReferenceInfo.CreateDirectReferenceInfos(ReferencePaths,
+ ReferenceInfo.CreateDirectReferenceInfos(
+ ReferencePaths,
ReferenceSatellitePaths,
- projectContextHasProjectReferences, isUserRuntimeAssembly);
+ lockFileLookup,
+ isUserRuntimeAssembly,
+ IncludeProjectsNotInAssetsFile);
IEnumerable dependencyReferences =
ReferenceInfo.CreateDependencyReferenceInfos(ReferenceDependencyPaths, ReferenceSatellitePaths, isUserRuntimeAssembly);
@@ -210,7 +213,7 @@ bool ShouldIncludeRuntimeAsset(ITaskItem item)
RuntimeGraph runtimeGraph =
IsSelfContained ? new RuntimeGraphCache(this).GetRuntimeGraph(RuntimeGraphPath) : null;
- builder = new DependencyContextBuilder(mainProject, IncludeRuntimeFileVersions, runtimeGraph, projectContext);
+ builder = new DependencyContextBuilder(mainProject, IncludeRuntimeFileVersions, runtimeGraph, projectContext, lockFileLookup);
}
else
{
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/ReferenceInfo.cs b/src/Tasks/Microsoft.NET.Build.Tasks/ReferenceInfo.cs
index dfe0866df067..11ad32000307 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/ReferenceInfo.cs
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/ReferenceInfo.cs
@@ -54,17 +54,49 @@ public static IEnumerable CreateReferenceInfos(IEnumerable CreateDirectReferenceInfos(
IEnumerable referencePaths,
IEnumerable referenceSatellitePaths,
- bool projectContextHasProjectReferences,
- Func isRuntimeAssembly)
+ LockFileLookup lockFileLookup,
+ Func isRuntimeAssembly,
+ bool includeProjectsNotInAssetsFile)
{
-
- bool filterOutProjectReferenceIfInProjectContextAlready(ITaskItem referencePath)
+ bool lockFileContainsProject(ITaskItem referencePath)
{
- return (projectContextHasProjectReferences ? !IsProjectReference(referencePath) : true);
+ if (lockFileLookup == null)
+ {
+ return false;
+ }
+
+ if (!IsProjectReference(referencePath))
+ {
+ return false;
+ }
+
+ if (!includeProjectsNotInAssetsFile)
+ {
+ return true;
+ }
+
+ string projectName;
+ string projectFilePath = referencePath.GetMetadata(MetadataKeys.MSBuildSourceProjectFile);
+ if (!string.IsNullOrEmpty(projectFilePath))
+ {
+ projectName = Path.GetFileNameWithoutExtension(projectFilePath);
+ }
+ else
+ {
+ // fall back to using the path to the output DLL
+ projectName = Path.GetFileNameWithoutExtension(referencePath.ItemSpec);
+ if (string.IsNullOrEmpty(projectName))
+ {
+ // unexpected - let's assume this project was already included in the assets file.
+ return true;
+ }
+ }
+
+ return lockFileLookup.GetProject(projectName) != null;
}
IEnumerable directReferencePaths = referencePaths
- .Where(r => filterOutProjectReferenceIfInProjectContextAlready(r) && !IsNuGetReference(r) && isRuntimeAssembly(r));
+ .Where(r => !lockFileContainsProject(r) && !IsNuGetReference(r) && isRuntimeAssembly(r));
return CreateFilteredReferenceInfos(directReferencePaths, referenceSatellitePaths);
}
@@ -147,7 +179,7 @@ private static string GetVersion(ITaskItem referencePath)
if (!string.IsNullOrEmpty(fusionName))
{
AssemblyName assemblyName = new AssemblyName(fusionName);
- version = assemblyName.Version.ToString();
+ version = assemblyName.Version?.ToString();
}
if (string.IsNullOrEmpty(version))
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DesignerSupport.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DesignerSupport.targets
index 31e6ec5f694d..000e7153f1b4 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DesignerSupport.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.DesignerSupport.targets
@@ -68,6 +68,7 @@ Copyright (c) .NET Foundation. All rights reserved.
ResolvedRuntimeTargetsFiles="@(RuntimeTargetsCopyLocalItems)"
TargetFramework="$(TargetFramework)"
RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)"
+ IncludeProjectsNotInAssetsFile="$(IncludeProjectsNotInAssetsFileInDepsFile)"
/>
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
index a943e6615bf4..09f458a7909b 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Publish.targets
@@ -986,7 +986,8 @@ Copyright (c) .NET Foundation. All rights reserved.
IsSelfContained="$(SelfContained)"
IsSingleFile="$(_IsSingleFilePublish)"
IncludeRuntimeFileVersions="$(IncludeFileVersionsInDependencyFile)"
- RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)"/>
+ RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)"
+ IncludeProjectsNotInAssetsFile="$(IncludeProjectsNotInAssetsFileInDepsFile)"/>
diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
index 4311ec0ecea2..1c3ba05e59c4 100644
--- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
+++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets
@@ -125,6 +125,11 @@ Copyright (c) .NET Foundation. All rights reserved.
false
+
+
+ false
+
+
_CheckForBuildWithNoBuild;
@@ -213,7 +218,8 @@ Copyright (c) .NET Foundation. All rights reserved.
ResolvedRuntimeTargetsFiles="@(RuntimeTargetsCopyLocalItems)"
IsSelfContained="$(SelfContained)"
IncludeRuntimeFileVersions="$(IncludeFileVersionsInDependencyFile)"
- RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)"/>
+ RuntimeGraphPath="$(BundledRuntimeIdentifierGraphFile)"
+ IncludeProjectsNotInAssetsFile="$(IncludeProjectsNotInAssetsFileInDepsFile)"/>
MainLibrary --depends on--> AuxLibrary (non-SDK)
+ // (TestApp transitively depends on AuxLibrary)
+ var testAsset = _testAssetsManager
+ .CreateTestProject(CreateTestProject());
+
+ VerifyAppBuilds(testAsset, string.Empty);
+ }
+
+ [WindowsOnlyTheory]
+ [InlineData("")]
+ [InlineData("TestApp.")]
+ public void It_builds_deps_correctly_when_projects_do_not_get_restored(string prefix)
+ {
+ // NOTE the projects created by CreateTestProject:
+ // TestApp --depends on--> MainLibrary --depends on--> AuxLibrary
+ // (TestApp transitively depends on AuxLibrary)
+ var testAsset = _testAssetsManager
+ .CreateTestProject(CreateTestProject())
+ .WithProjectChanges(
+ (projectName, project) =>
+ {
+ string projectFileName = Path.GetFileNameWithoutExtension(projectName);
+ if (StringComparer.OrdinalIgnoreCase.Equals(projectFileName, "AuxLibrary") ||
+ StringComparer.OrdinalIgnoreCase.Equals(projectFileName, "MainLibrary"))
+ {
+ var ns = project.Root.Name.Namespace;
+
+ XElement propertyGroup = project.Root.Element(ns + "PropertyGroup");
+ if (!string.IsNullOrEmpty(prefix))
+ {
+ XElement assemblyName = propertyGroup.Element(ns + "AssemblyName");
+ assemblyName.RemoveAll();
+ assemblyName.Add(prefix + projectFileName);
+ }
+
+ // indicate that project restore is not supported for these projects:
+ var target = new XElement(ns + "Target",
+ new XAttribute("Name", "_IsProjectRestoreSupported"),
+ new XAttribute("Returns", "@(_ValidProjectsForRestore)"));
+
+ project.Root.Add(target);
+ }
+ else // if (StringComparer.OrdinalIgnoreCase.Equals(projectFileName, "TestApp"))
+ {
+ var ns = project.Root.Name.Namespace;
+
+ XElement propertyGroup = project.Root.Element(ns + "PropertyGroup");
+
+ XElement includeProjectsNotInAssetsFileInDepsFile = new XElement(ns + "IncludeProjectsNotInAssetsFileInDepsFile");
+ includeProjectsNotInAssetsFileInDepsFile.Add("true");
+ propertyGroup.Add(includeProjectsNotInAssetsFileInDepsFile);
+ }
+ });
+
+ string outputDirectory = VerifyAppBuilds(testAsset, prefix);
+
+ using (var depsJsonFileStream = File.OpenRead(Path.Combine(outputDirectory, "TestApp.deps.json")))
+ {
+ var dependencyContext = new DependencyContextJsonReader().Read(depsJsonFileStream);
+
+ var projectNames = dependencyContext.RuntimeLibraries.Select(library => library.Name).ToList();
+ projectNames.Should().BeEquivalentTo(new[] { "TestApp", prefix + "AuxLibrary", prefix + "MainLibrary" });
+ }
+ }
+
+ private TestProject CreateTestProject()
+ {
+ string targetFrameworkVersion = "v4.8";
+
+ var auxLibraryProject = new TestProject("AuxLibrary")
+ {
+ IsSdkProject = false,
+ TargetFrameworkVersion = targetFrameworkVersion
+ };
+ auxLibraryProject.SourceFiles["Helper.cs"] = @"
+ using System;
+
+ namespace AuxLibrary
+ {
+ public static class Helper
+ {
+ public static void WriteMessage()
+ {
+ Console.WriteLine(""This string came from AuxLibrary!"");
+ }
+ }
+ }
+ ";
+
+ var mainLibraryProject = new TestProject("MainLibrary")
+ {
+ IsSdkProject = false,
+ TargetFrameworkVersion = targetFrameworkVersion
+ };
+ mainLibraryProject.ReferencedProjects.Add(auxLibraryProject);
+ mainLibraryProject.SourceFiles["Helper.cs"] = @"
+ using System;
+
+ namespace MainLibrary
+ {
+ public static class Helper
+ {
+ public static void WriteMessage()
+ {
+ Console.WriteLine(""This string came from MainLibrary!"");
+ AuxLibrary.Helper.WriteMessage();
+ }
+ }
+ }
+ ";
+
+ var testAppProject = new TestProject("TestApp")
+ {
+ IsExe = true,
+ TargetFrameworks = ToolsetInfo.CurrentTargetFramework
+ };
+ testAppProject.AdditionalProperties["ProduceReferenceAssembly"] = "false";
+ testAppProject.ReferencedProjects.Add(mainLibraryProject);
+ testAppProject.SourceFiles["Program.cs"] = @"
+ using System;
+
+ namespace TestApp
+ {
+ public class Program
+ {
+ public static void Main(string[] args)
+ {
+ Console.WriteLine(""TestApp --depends on--> MainLibrary --depends on--> AuxLibrary"");
+ MainLibrary.Helper.WriteMessage();
+ }
+ }
+ }
+ ";
+
+ return testAppProject;
+ }
+
+ private string VerifyAppBuilds(TestAsset testAsset, string prefix)
+ {
+ var buildCommand = new BuildCommand(testAsset, "TestApp");
+ var outputDirectory = buildCommand.GetOutputDirectory(ToolsetInfo.CurrentTargetFramework);
+
+ buildCommand
+ .Execute()
+ .Should()
+ .Pass();
+
+ outputDirectory.Should().OnlyHaveFiles(new[] {
+ "TestApp.dll",
+ "TestApp.pdb",
+ $"TestApp{EnvironmentInfo.ExecutableExtension}",
+ "TestApp.deps.json",
+ "TestApp.runtimeconfig.json",
+ prefix + "MainLibrary.dll",
+ prefix + "MainLibrary.pdb",
+ prefix + "AuxLibrary.dll",
+ prefix + "AuxLibrary.pdb",
+ });
+
+ new DotnetCommand(Log, Path.Combine(outputDirectory.FullName, "TestApp.dll"))
+ .Execute()
+ .Should()
+ .Pass()
+ .And
+ .HaveStdOutContaining("This string came from MainLibrary!")
+ .And
+ .HaveStdOutContaining("This string came from AuxLibrary!");
+
+ return outputDirectory.FullName;
+ }
+ }
+}
diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithTransitiveProjectRefs.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithTransitiveProjectRefs.cs
index c8086768b40f..479a30b06e9c 100644
--- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithTransitiveProjectRefs.cs
+++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildAnAppWithTransitiveProjectRefs.cs
@@ -123,7 +123,9 @@ public void It_does_not_build_the_project_successfully()
buildCommand
.Execute("/p:DisableTransitiveProjectReferences=true")
.Should()
- .Fail();
+ .Fail()
+ .And
+ .HaveStdOutContaining("CS0103");
}
}
}
diff --git a/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs b/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs
index c2871b869b4b..9a367928afd1 100644
--- a/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs
+++ b/src/Tests/dotnet-build.Tests/GivenDotnetBuildBuildsCsproj.cs
@@ -87,7 +87,7 @@ public void ItCanBuildAMultiTFMProjectWithImplicitRestore()
string projectDirectory = Path.Combine(testInstance.Path, "MultiTFMTestApp");
new DotnetBuildCommand(Log, projectDirectory)
- .Execute("--framework", "netcoreapp3.1")
+ .Execute("--framework", ToolsetInfo.CurrentTargetFramework)
.Should().Pass();
}
@@ -183,7 +183,7 @@ public void It_warns_on_rid_without_self_contained_options()
{
var testInstance = _testAssetsManager.CopyTestAsset("HelloWorld")
.WithSource()
- .WithTargetFrameworkOrFrameworks("net6.0", false)
+ .WithTargetFrameworkOrFrameworks(ToolsetInfo.CurrentTargetFramework, false)
.Restore(Log);
new DotnetBuildCommand(Log)
@@ -223,7 +223,7 @@ public void It_does_not_warn_on_rid_with_self_contained_options(string commandNa
{
var testInstance = _testAssetsManager.CopyTestAsset("HelloWorld", identifier: commandName)
.WithSource()
- .WithTargetFrameworkOrFrameworks("net6.0", false)
+ .WithTargetFrameworkOrFrameworks(ToolsetInfo.CurrentTargetFramework, false)
.Restore(Log);
new DotnetCommand(Log)
diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs
index c7f439774a27..6e24b69ad900 100644
--- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs
+++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs
@@ -67,7 +67,7 @@ public void ItImplicitlyRestoresAProjectWhenPublishing()
.Should().Pass();
}
- [Fact(Skip = "https://github.com/dotnet/sdk/issues/19487")]
+ [Fact]
public void ItCanPublishAMultiTFMProjectWithImplicitRestore()
{
var testInstance = _testAssetsManager.CopyTestAsset(
diff --git a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs
index 4187372d2246..4b5209f42953 100644
--- a/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs
+++ b/src/Tests/dotnet-run.Tests/GivenDotnetRunRunsCsProj.cs
@@ -72,7 +72,7 @@ public void ItCanRunAMultiTFMProjectWithImplicitRestore()
new DotnetCommand(Log, "run")
.WithWorkingDirectory(projectDirectory)
- .Execute("--framework", "netcoreapp3.1")
+ .Execute("--framework", ToolsetInfo.CurrentTargetFramework)
.Should().Pass()
.And.HaveStdOutContaining("This string came from the test library!");
}
@@ -127,7 +127,7 @@ public void ItBuildsTheProjectBeforeRunning()
.And.HaveStdOutContaining("Hello World!");
}
- [Fact(Skip = "https://github.com/dotnet/sdk/issues/19487#issuecomment-898765210")]
+ [Fact]
public void ItCanRunAMSBuildProjectWhenSpecifyingAFramework()
{
var testAppName = "MSBuildTestApp";
@@ -138,7 +138,7 @@ public void ItCanRunAMSBuildProjectWhenSpecifyingAFramework()
new DotnetCommand(Log, "run")
.WithWorkingDirectory(testProjectDirectory)
- .Execute("--framework", "netcoreapp3.1")
+ .Execute("--framework", ToolsetInfo.CurrentTargetFramework)
.Should().Pass()
.And.HaveStdOut("Hello World!");
}
diff --git a/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs b/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs
index 78f4983bdea0..12447f449793 100644
--- a/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs
+++ b/src/Tests/dotnet-test.Tests/GivenDotnetTestBuildsAndRunsTestFromCsprojForMultipleTFM.cs
@@ -142,7 +142,7 @@ public void ItCanTestAMultiTFMProjectWithImplicitRestore()
new DotnetTestCommand(Log, ConsoleLoggerOutputNormal)
.WithWorkingDirectory(projectDirectory)
- .Execute("--framework", "netcoreapp3.0")
+ .Execute("--framework", ToolsetInfo.CurrentTargetFramework)
.Should().Pass();
}