From 35bdab79adf55acd9132465c68309c40671b6905 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 16 Sep 2022 14:25:55 -0700 Subject: [PATCH 01/19] Implement publish-self-contained and add tests. --- ...eCommandLineSelfContainedToBeLocal.targets | 6 ++ ...oft.NET.RuntimeIdentifierInference.targets | 7 +- .../Microsoft.NET.Sdk.BeforeCommon.targets | 4 +- .../targets/Microsoft.NET.Sdk.props | 2 +- ...GivenThatWeWantToBuildASelfContainedApp.cs | 28 +++++++ .../GivenDotnetPublishPublishesProjects.cs | 81 +++++++++++++++++++ 6 files changed, 125 insertions(+), 3 deletions(-) create mode 100644 src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets new file mode 100644 index 000000000000..9879c8211f6d --- /dev/null +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets @@ -0,0 +1,6 @@ + + + false + true + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 279717af4f5c..4824046115ea 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -70,7 +70,8 @@ Copyright (c) .NET Foundation. All rights reserved. '$(SelfContained)' == 'true' or '$(PublishReadyToRun)' == 'true' or '$(PublishSingleFile)' == 'true' or - '$(PublishAot)' == 'true' + '$(PublishAot)' == 'true' or + '$(PublishSelfContained)' == 'true' )">true @@ -169,6 +170,10 @@ Copyright (c) .NET Foundation. All rights reserved. ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed" FormatArguments="SelfContained"/> + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 2ff2c1de9993..feb73618b365 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -22,7 +22,6 @@ Copyright (c) .NET Foundation. All rights reserved. <_IsExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)'=='WinExe'">true - @@ -35,6 +34,9 @@ Copyright (c) .NET Foundation. All rights reserved. + + + diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props index 73a182102d13..13cda738fa8e 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.props @@ -20,7 +20,7 @@ Copyright (c) .NET Foundation. All rights reserved. Debug;Release AnyCPU - Debug + Debug AnyCPU diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 5e4d21f01334..845639992468 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -374,6 +374,34 @@ public void It_can_publish_runtime_specific_apps_with_library_dependencies_self_ publishCommand.Execute(new [] {"-property:SelfContained=true", "-property:_CommandLineDefinedSelfContained=true", $"-property:RuntimeIdentifier={rid}", "-property:_CommandLineDefinedRuntimeIdentifier=true" }).Should().Pass().And.NotHaveStdOutContaining("warning"); } + [Theory] + [InlineData("net7.0")] + public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_true(string targetFramework) + { + var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld", identifier: targetFramework) + .WithSource() + .WithTargetFramework(targetFramework) + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); + propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); + }); + + var buildCommand = new BuildCommand(testAsset); + + buildCommand + .Execute("-p:SelfContained=false") + .Should() + .Pass(); + + var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); + outputDirectory.Should().NotHaveFile("hostfxr.dll"); + } + [Theory] [InlineData("net7.0")] public void It_builds_a_runnable_output_with_Prefer32Bit(string targetFramework) diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index c7f439774a27..81ccbe7049d6 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -3,7 +3,9 @@ using System; using System.IO; +using System.Linq; using System.Runtime.CompilerServices; +using System.Xml.Linq; using FluentAssertions; using Microsoft.DotNet.Cli.Utils; using Microsoft.DotNet.Tools; @@ -137,6 +139,85 @@ public void ItPublishesSelfContainedWithRid(string args) .And.HaveStdOutContaining("Hello World"); } + [Fact] + public void ItPublishesSelfContainedWithPublishSelfContainedTrue() + { + var testAppName = "MSBuildTestApp"; + var rid = EnvironmentInfo.GetCompatibleRid(); + var outputDirectory = PublishApp(testAppName, rid, "-p:PublishSelfContained=true"); + + var outputProgram = Path.Combine(outputDirectory.FullName, $"{testAppName}{Constants.ExeSuffix}"); + + outputDirectory.Should().HaveFiles(new[] { + "System.dll", // File that should only exist if self contained + }); + + new RunExeCommand(Log, outputProgram) + .Execute() + .Should().Pass() + .And.HaveStdOutContaining("Hello World"); + } + + [Theory] + [InlineData("net7.0")] + public void ItPublishesSelfContainedWithPublishSelfContainedProperty(string targetFramework) + { + var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld", identifier: targetFramework) + .WithSource() + .WithTargetFramework(targetFramework) + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); + }); + + var publishCommand = new PublishCommand(testAsset); + var publishResult = publishCommand.Execute($"/p:RuntimeIdentifier={rid}"); + + publishResult.Should().Pass(); + + var publishDirectory = publishCommand.GetOutputDirectory( + targetFramework: targetFramework, + runtimeIdentifier: rid); + publishDirectory.Should().HaveFiles(new[] { + "HelloWorld.dll", + "System.dll" + }); + } + + [RequiresMSBuildVersionTheory("17.5.0.0")] // This needs _IsPublishing to be set in MSBuild to pass. + [InlineData("net7.0")] + public void PublishSelfContainedPropertyOverridesSelfContainProperty(string targetFramework) + { + var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); + + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld") + .WithSource() + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); + }); + + var publishCommand = new PublishCommand(testAsset); + var publishResult = publishCommand.Execute( $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=false"); + + publishResult.Should().Pass(); + + var publishDirectory = publishCommand.GetOutputDirectory( + targetFramework: targetFramework, + runtimeIdentifier: rid); + publishDirectory.Should().HaveFiles(new[] { + "HelloWorld.dll", + "System.dll" // File that should only exist if self contained + }); + } + [Theory] [InlineData("--sc=false")] [InlineData("--self-contained=false")] From 5a3000e60d0755f6d19a990915fc992ae17455b2 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 21 Oct 2022 14:12:15 -0700 Subject: [PATCH 02/19] Test now considers proper behavior with globals --- .../GivenDotnetPublishPublishesProjects.cs | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 81ccbe7049d6..6a0163f6b0bd 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System; +using System.Collections.Generic; using System.IO; using System.Linq; using System.Runtime.CompilerServices; @@ -188,9 +189,52 @@ public void ItPublishesSelfContainedWithPublishSelfContainedProperty(string targ }); } + [RequiresMSBuildVersionTheory("17.5.0.0")] // This needs _IsPublishing to be set in MSBuild to pass. + [InlineData("net7.0", true, false, false)] + [InlineData("net7.0", false, false, false)] + [InlineData("net7.0", true, true, false)] + [InlineData("net7.0", true, true, true)] + public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty(string targetFramework, bool publishSelfContained, bool selfContainedIsGlobal, bool publishSelfContainedIsGlobal) + { + var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); + + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld") + .WithSource() + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "SelfContained", (!publishSelfContained).ToString())); + propertyGroup.Add(new XElement(ns + "PublishSelfContained", publishSelfContained.ToString())); + }); + + var publishCommand = new PublishCommand(testAsset); + List args = new List + { + $"/p:RuntimeIdentifier={rid}", + selfContainedIsGlobal ? $"/p:SelfContained={!publishSelfContained}" : "", + publishSelfContainedIsGlobal ? $"/p:PublishSelfContained={publishSelfContained}" : "" + }; + + publishCommand + .Execute(args.ToArray()) + .Should() + .Pass(); + + var publishedDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid); + var expectedFiles = new[] { "HelloWorld.dll" }; + + if (publishSelfContained && !selfContainedIsGlobal) + expectedFiles.Append("System.dll"); // System.dll should only exist if self contained + + publishedDirectory.Should().HaveFiles(expectedFiles); + } + + [RequiresMSBuildVersionTheory("17.5.0.0")] // This needs _IsPublishing to be set in MSBuild to pass. [InlineData("net7.0")] - public void PublishSelfContainedPropertyOverridesSelfContainProperty(string targetFramework) + public void PublishSelfContainedPropertyDoesNotOverrideGlobalSelfContainProperty(string targetFramework) { var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); @@ -205,7 +249,7 @@ public void PublishSelfContainedPropertyOverridesSelfContainProperty(string targ }); var publishCommand = new PublishCommand(testAsset); - var publishResult = publishCommand.Execute( $"/p:RuntimeIdentifier={rid}", "/p:SelfContained=false"); + var publishResult = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=false"); publishResult.Should().Pass(); From 09084235abfdf4ee247ee7b501008bd9c023b348 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 21 Oct 2022 14:27:39 -0700 Subject: [PATCH 03/19] Change the precedence of SC vs PSC --- ...ft.NET.ForceCommandLineSelfContainedToBeLocal.targets | 6 ------ .../targets/Microsoft.NET.Sdk.BeforeCommon.targets | 9 ++++++--- .../GivenDotnetPublishPublishesProjects.cs | 3 ++- 3 files changed, 8 insertions(+), 10 deletions(-) delete mode 100644 src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets deleted file mode 100644 index 9879c8211f6d..000000000000 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.ForceCommandLineSelfContainedToBeLocal.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - false - true - - diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index feb73618b365..050678f604ec 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -34,9 +34,12 @@ Copyright (c) .NET Foundation. All rights reserved. - - - + + + false + true + + diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 6a0163f6b0bd..81075dec88c2 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -189,7 +189,7 @@ public void ItPublishesSelfContainedWithPublishSelfContainedProperty(string targ }); } - [RequiresMSBuildVersionTheory("17.5.0.0")] // This needs _IsPublishing to be set in MSBuild to pass. + [Theory] [InlineData("net7.0", true, false, false)] [InlineData("net7.0", false, false, false)] [InlineData("net7.0", true, true, false)] @@ -213,6 +213,7 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty( List args = new List { $"/p:RuntimeIdentifier={rid}", + $"/p:_IsPublishing=true", // Normally this would be set by the CLI (OR VS Soon TM), but this calls directly into t:/Publish. selfContainedIsGlobal ? $"/p:SelfContained={!publishSelfContained}" : "", publishSelfContainedIsGlobal ? $"/p:PublishSelfContained={publishSelfContained}" : "" }; From 30fc065a241282abf2a8dab2d7e4b294b6fbd257 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 21 Oct 2022 14:37:57 -0700 Subject: [PATCH 04/19] Remove redundant tests --- .../Microsoft.NET.Sdk.BeforeCommon.targets | 3 +- ...GivenThatWeWantToBuildASelfContainedApp.cs | 5 +- .../GivenDotnetPublishPublishesProjects.cs | 61 ------------------- 3 files changed, 5 insertions(+), 64 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 050678f604ec..384dbb1adbc0 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -34,7 +34,8 @@ Copyright (c) .NET Foundation. All rights reserved. - + false true diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 845639992468..1401c1195239 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -388,18 +388,19 @@ public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_tr var ns = project.Root.Name.Namespace; var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); + propertyGroup.Add(new XElement(ns + "SelfContained", "false")); propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); }); var buildCommand = new BuildCommand(testAsset); buildCommand - .Execute("-p:SelfContained=false") + .Execute() .Should() .Pass(); var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); - outputDirectory.Should().NotHaveFile("hostfxr.dll"); + outputDirectory.Should().NotHaveFile("hostfxr.dll"); // This file will only appear if SelfContained. } [Theory] diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 81075dec88c2..a1fd6542d337 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -159,36 +159,6 @@ public void ItPublishesSelfContainedWithPublishSelfContainedTrue() .And.HaveStdOutContaining("Hello World"); } - [Theory] - [InlineData("net7.0")] - public void ItPublishesSelfContainedWithPublishSelfContainedProperty(string targetFramework) - { - var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); - var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld", identifier: targetFramework) - .WithSource() - .WithTargetFramework(targetFramework) - .WithProjectChanges(project => - { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); - }); - - var publishCommand = new PublishCommand(testAsset); - var publishResult = publishCommand.Execute($"/p:RuntimeIdentifier={rid}"); - - publishResult.Should().Pass(); - - var publishDirectory = publishCommand.GetOutputDirectory( - targetFramework: targetFramework, - runtimeIdentifier: rid); - publishDirectory.Should().HaveFiles(new[] { - "HelloWorld.dll", - "System.dll" - }); - } - [Theory] [InlineData("net7.0", true, false, false)] [InlineData("net7.0", false, false, false)] @@ -232,37 +202,6 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty( publishedDirectory.Should().HaveFiles(expectedFiles); } - - [RequiresMSBuildVersionTheory("17.5.0.0")] // This needs _IsPublishing to be set in MSBuild to pass. - [InlineData("net7.0")] - public void PublishSelfContainedPropertyDoesNotOverrideGlobalSelfContainProperty(string targetFramework) - { - var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); - - var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld") - .WithSource() - .WithProjectChanges(project => - { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); - }); - - var publishCommand = new PublishCommand(testAsset); - var publishResult = publishCommand.Execute($"/p:RuntimeIdentifier={rid}", "/p:SelfContained=false"); - - publishResult.Should().Pass(); - - var publishDirectory = publishCommand.GetOutputDirectory( - targetFramework: targetFramework, - runtimeIdentifier: rid); - publishDirectory.Should().HaveFiles(new[] { - "HelloWorld.dll", - "System.dll" // File that should only exist if self contained - }); - } - [Theory] [InlineData("--sc=false")] [InlineData("--self-contained=false")] From 537f69e631ba39253e62499102a4478d82a3dfd5 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 21 Oct 2022 14:47:49 -0700 Subject: [PATCH 05/19] Only do the RID inference if we're publishing. --- .../targets/Microsoft.NET.RuntimeIdentifierInference.targets | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 4824046115ea..effd43977087 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -71,7 +71,7 @@ Copyright (c) .NET Foundation. All rights reserved. '$(PublishReadyToRun)' == 'true' or '$(PublishSingleFile)' == 'true' or '$(PublishAot)' == 'true' or - '$(PublishSelfContained)' == 'true' + ('$(_IsPublishing)' == 'true' and '$(PublishSelfContained)' == 'true') )">true @@ -170,7 +170,7 @@ Copyright (c) .NET Foundation. All rights reserved. ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed" FormatArguments="SelfContained"/> - From bac1d6d113e77c5f45cefffd91b78b0de702065c Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 21 Oct 2022 14:58:59 -0700 Subject: [PATCH 06/19] Add PSC RID test --- .../GivenThatWeWantToPublishAHelloWorldProject.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs index a7c76ba87922..beb6d858e700 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAHelloWorldProject.cs @@ -1080,6 +1080,7 @@ public void It_publishes_with_full_path_publish_profile() [Theory] [InlineData("--p:PublishReadyToRun=true")] [InlineData("-p:PublishSingleFile=true")] + [InlineData("-p:PublishSelfContained=true")] [InlineData("")] public void It_publishes_with_implicit_rid_with_rid_specific_properties(string executeOptionsAndProperties) { From 385a936c1fe286517aa395ed514d740b73b1393f Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Fri, 21 Oct 2022 16:29:52 -0700 Subject: [PATCH 07/19] Use unique test names in theory so helix doesnt be a baka: --- .../GivenThatWeWantToBuildASelfContainedApp.cs | 2 +- .../dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index 1401c1195239..d9bfe1b371e5 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -380,7 +380,7 @@ public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_tr { var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld", identifier: targetFramework) + .CopyTestAsset("HelloWorld", identifier: "ItDoesNotBuildSCDueToPSC") .WithSource() .WithTargetFramework(targetFramework) .WithProjectChanges(project => diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index a1fd6542d337..d845ab5d16ee 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -169,7 +169,7 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty( var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld") + .CopyTestAsset("HelloWorld", identifier: $"PSC-OVERRIDES-{publishSelfContained}-{selfContainedIsGlobal}-{publishSelfContainedIsGlobal}") .WithSource() .WithProjectChanges(project => { From 8516ab65d6b8339350854c730b3054bdfbfc6783 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 24 Oct 2022 17:01:23 -0700 Subject: [PATCH 08/19] Clean up code around targets --- .../Microsoft.NET.RuntimeIdentifierInference.targets | 2 +- .../targets/Microsoft.NET.Sdk.BeforeCommon.targets | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index effd43977087..8475d1cda521 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -71,7 +71,7 @@ Copyright (c) .NET Foundation. All rights reserved. '$(PublishReadyToRun)' == 'true' or '$(PublishSingleFile)' == 'true' or '$(PublishAot)' == 'true' or - ('$(_IsPublishing)' == 'true' and '$(PublishSelfContained)' == 'true') + ('$(_CommandLineDefinedSelfContained)' != 'true' and '$(_IsPublishing)' == 'true' and '$(PublishSelfContained)' == 'true') )">true diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 384dbb1adbc0..9a6416e9c2c7 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -23,7 +23,7 @@ Copyright (c) .NET Foundation. All rights reserved. <_IsExecutable Condition="'$(OutputType)' == 'Exe' or '$(OutputType)'=='WinExe'">true - + $(_IsExecutable) <_UsingDefaultForHasRuntimeOutput>true @@ -36,11 +36,10 @@ Copyright (c) .NET Foundation. All rights reserved. - - false - true + + $(PublishSelfContained) - + From d923dae704d5ea252bd465e149350cd22722055f Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 24 Oct 2022 17:08:09 -0700 Subject: [PATCH 09/19] Dont use PSC for RID checks. --- .../Microsoft.NET.RuntimeIdentifierInference.targets | 9 +++++++-- .../targets/Microsoft.NET.Sdk.BeforeCommon.targets | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 8475d1cda521..752a08c33afe 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -61,6 +61,11 @@ Copyright (c) .NET Foundation. All rights reserved. win7-x86 + + + <_PublishSelfContainedIsActive>true + + true @@ -170,7 +175,7 @@ Copyright (c) .NET Foundation. All rights reserved. ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed" FormatArguments="SelfContained"/> - diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 9a6416e9c2c7..1ce6e4e621ca 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -36,7 +36,7 @@ Copyright (c) .NET Foundation. All rights reserved. - + $(PublishSelfContained) From 7c50bac59268e4424944493eca127b677ec06e5c Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Oct 2022 10:18:17 -0700 Subject: [PATCH 10/19] Consider the case where SelfContained is global but not passed in CLI --- ...oft.NET.RuntimeIdentifierInference.targets | 27 ++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 752a08c33afe..8a9dc347f9c9 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -61,8 +61,33 @@ Copyright (c) .NET Foundation. All rights reserved. win7-x86 + + + <_OriginalSelfContainedValue>$(SelfContained) + + + + + + + + <_SelfContainedIsGlobal>true + + + + + <_SelfContainedIsGlobal>false + + + + + + $(OriginalSelfContainedValue) + <_OriginalSelfContainedValue> + + - + <_PublishSelfContainedIsActive>true From c95ff57962012dfc68fab8150db21f2b6a3224eb Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Oct 2022 11:14:14 -0700 Subject: [PATCH 11/19] All of the examples work now --- ...soft.NET.RuntimeIdentifierInference.targets | 18 ++++++++++++------ .../Microsoft.NET.Sdk.BeforeCommon.targets | 6 ------ .../GivenThatWeWantToPublishAWebApp.cs | 2 +- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 8a9dc347f9c9..449ebb565184 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -61,14 +61,14 @@ Copyright (c) .NET Foundation. All rights reserved. win7-x86 - + <_OriginalSelfContainedValue>$(SelfContained) - + <_SelfContainedIsGlobal>true @@ -82,15 +82,21 @@ Copyright (c) .NET Foundation. All rights reserved. - $(OriginalSelfContainedValue) + $(_OriginalSelfContainedValue) <_OriginalSelfContainedValue> - + <_PublishSelfContainedIsActive>true + + + $(PublishSelfContained) + + true @@ -200,7 +206,7 @@ Copyright (c) .NET Foundation. All rights reserved. ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed" FormatArguments="SelfContained"/> - diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets index 1ce6e4e621ca..6bb5e58f3aff 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.BeforeCommon.targets @@ -34,12 +34,6 @@ Copyright (c) .NET Foundation. All rights reserved. - - - $(PublishSelfContained) - - diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs index ed7f4e373072..1656f9fa5026 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs @@ -201,7 +201,7 @@ public void PublishWebAppWithPublishProfile(bool? selfContained, bool? useAppHos var command = new PublishCommand(testProjectInstance); command - .Execute("/p:PublishProfile=test") + .Execute("/p:PublishProfile=test", "-bl:C:\\users\\noahgilson\\SELFCP.binlog") .Should() .Pass(); From a2f448b19b42d55c8f95f6e4bd4351d2d50c78cb Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 25 Oct 2022 11:25:55 -0700 Subject: [PATCH 12/19] Remove bl artifact --- .../GivenThatWeWantToPublishAWebApp.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs index 1656f9fa5026..ed7f4e373072 100644 --- a/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs +++ b/src/Tests/Microsoft.NET.Publish.Tests/GivenThatWeWantToPublishAWebApp.cs @@ -201,7 +201,7 @@ public void PublishWebAppWithPublishProfile(bool? selfContained, bool? useAppHos var command = new PublishCommand(testProjectInstance); command - .Execute("/p:PublishProfile=test", "-bl:C:\\users\\noahgilson\\SELFCP.binlog") + .Execute("/p:PublishProfile=test") .Should() .Pass(); From 91fc5b004fa7200fb88c31702c13c29838f104b0 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 26 Oct 2022 15:55:11 -0700 Subject: [PATCH 13/19] Remove the ridiculous amount of overengineering --- ...oft.NET.RuntimeIdentifierInference.targets | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 449ebb565184..1c05fbe8304d 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -61,39 +61,9 @@ Copyright (c) .NET Foundation. All rights reserved. win7-x86 - - - <_OriginalSelfContainedValue>$(SelfContained) - - - - - - - - <_SelfContainedIsGlobal>true - - - - - <_SelfContainedIsGlobal>false - - - - - - $(_OriginalSelfContainedValue) - <_OriginalSelfContainedValue> - - - - - <_PublishSelfContainedIsActive>true - - - + $(PublishSelfContained) @@ -106,8 +76,7 @@ Copyright (c) .NET Foundation. All rights reserved. '$(SelfContained)' == 'true' or '$(PublishReadyToRun)' == 'true' or '$(PublishSingleFile)' == 'true' or - '$(PublishAot)' == 'true' or - ('$(_PublishSelfContainedIsActive)' == 'true' and '$(PublishSelfContained)' == 'true') + '$(PublishAot)' == 'true' )">true From 0f8d4a71e44d5522f47fe71f9dd25a9e4b5a0167 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Thu, 27 Oct 2022 09:55:13 -0700 Subject: [PATCH 14/19] Add warning for invalid publishsc values --- src/Tasks/Common/Resources/Strings.resx | 4 ++++ src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.de.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.es.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.it.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 5 +++++ src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 5 +++++ .../Common/Resources/xlf/Strings.zh-Hans.xlf | 5 +++++ .../Common/Resources/xlf/Strings.zh-Hant.xlf | 5 +++++ ...crosoft.NET.RuntimeIdentifierInference.targets | 5 +++++ .../GivenDotnetPublishPublishesProjects.cs | 15 +++++++++++++++ 16 files changed, 89 insertions(+) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 1b1faf9abff2..04ed47de85b9 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -875,4 +875,8 @@ You may need to build the project on another operating system or architecture, o NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported. {StrBegin="NETSDK1192: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index e93d618d3366..6695d0df3263 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Kompilace ReadyToRun se přeskočí, protože se podporuje jen pro architekturu .NET Core 3.0 a vyšší. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Publikování aplikace do jednoho souboru vyžaduje architekturu .NET Core 3.0 nebo vyšší. diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 35e198b28c46..8964e78fd6ef 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Die ReadyToRun-Kompilierung wird übersprungen, weil sie nur für .NET Core 3.0 oder höher unterstützt wird. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Zum Veröffentlichen einer Anwendung in einer einzelnen Datei ist .NET Core 3.0 oder höher erforderlich. diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index 1131ed968991..e50b33662e4a 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Se omitirá la compilación de ReadyToRun porque solo se admite para .NET Core 3.0 o versiones posteriores. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: La publicación de una aplicación en un único archivo requiere .NET Core 3.0 o versiones posteriores. diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index ad677f798da7..93bb798b7bf5 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: la compilation ReadyToRun va être ignorée, car elle est uniquement prise en charge pour .NET Core 3.0 ou une version ultérieure. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: la publication d'une application sur un seul fichier nécessite .NET Core 3.0 ou une version ultérieure. diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index b4ded4b338b6..973cfffb0294 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: la compilazione eseguita con ReadyToRun verrà ignorata perché è supportata solo per .NET Core 3.0 o versioni successive. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: per la pubblicazione di un'applicazione in un file singolo è richiesto .NET Core 3.0 o versioni successive. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index 0b60a56d09f3..b2e92f72528f 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: ReadyToRun コンパイルは、.NET Core 3.0 以降でのみサポートされているため、スキップされます。 {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: アプリケーションを 1 つのファイルに発行するには、.NET Core 3.0 以降が必要です。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 5ecaffe04c53..9c4324313549 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: ReadyToRun 컴파일은 .NET Core 3.0 이상에서만 지원되므로 건너뜁니다. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: 애플리케이션을 단일 파일에 게시하려면 .NET Core 3.0 이상이 필요합니다. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index b2dab705d0f0..5ab487a42688 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: Kompilacja ReadyToRun zostanie pominięta, ponieważ jest obsługiwana tylko w przypadku platformy .NET Core 3.0 lub nowszej. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Publikowanie aplikacji do pojedynczego pliku wymaga platformy .NET Core 3.0 lub nowszej. diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 9ec54bd0f195..71409117b491 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: a compilação de ReadyToRun será ignorada porque ela é compatível apenas com o .NET Core 3.0 ou superior. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: a publicação de um aplicativo em um único arquivo exige o .NET Core 3.0 ou superior. diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index 5f422432fd96..ed15554f78ba 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: компиляция ReadyToRun будет пропущена, так как она поддерживается только для .NET Core 3.0 или более поздних версий. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: для публикации приложения в один файл требуется .NET Core 3.0 или более поздняя версия. diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 4e16cdd37aa4..18f3ef251f72 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: ReadyToRun derlemesi, yalnızca .NET Core 3.0 veya üzeri için desteklendiğinden atlanacak. {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: Bir uygulamayı tek bir dosyada yayımlamak için .NET Core 3.0 veya üzeri gerekir. diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index 61d11bbbf2e7..b97f5e6a8cc3 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: 将跳过 ReadyToRun 编译,因为只有 .NET Core 3.0 或更高版本才支持该编译。 {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: 将应用程序发布到单个文件需要 .NET Core 3.0 或更高版本。 diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index e4f292c543aa..71edc797ae70 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -720,6 +720,11 @@ The following are names of parameters or literal values and should not be transl NETSDK1122: 將跳過 ReadyToRun 編譯,原因是只有 .NET Core 3.0 或更高版本支援此作業。 {StrBegin="NETSDK1122: "} + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. NETSDK1123: 將應用程式發行至單一檔案需使用 .NET Core 3.0 或更高版本。 diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index 1c05fbe8304d..dd3284c2df61 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -192,6 +192,11 @@ Copyright (c) .NET Foundation. All rights reserved. FormatArguments="PublishAot"/> + + + diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index d845ab5d16ee..88bee5bbba12 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -202,6 +202,21 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty( publishedDirectory.Should().HaveFiles(expectedFiles); } + [Fact] + public void ItFailsWith1193IfPublishSelfContainedHasInvalidValue() + { + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld", identifier: "NET1193Failure") + .WithSource(); + + var publishCommand = new PublishCommand(testAsset); + publishCommand + .Execute("-p:PublishSelfContained=Invalid") + .Should() + .Fail() + .And.HaveStdOutContaining("NETSDK1193"); + } + [Theory] [InlineData("--sc=false")] [InlineData("--self-contained=false")] From 159c5d3315880ce1acd6956b885d2f2bf29b3320 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 31 Oct 2022 11:15:25 -0700 Subject: [PATCH 15/19] Add more precise language to the error Co-authored-by: Daniel Plaisted --- src/Tasks/Common/Resources/Strings.resx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Tasks/Common/Resources/Strings.resx b/src/Tasks/Common/Resources/Strings.resx index 04ed47de85b9..60ff66549eab 100644 --- a/src/Tasks/Common/Resources/Strings.resx +++ b/src/Tasks/Common/Resources/Strings.resx @@ -876,7 +876,7 @@ You may need to build the project on another operating system or architecture, o {StrBegin="NETSDK1192: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} From 4ad49d671d8f1a4d6698d3597d4d99e134a6805f Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Mon, 31 Oct 2022 17:00:00 -0700 Subject: [PATCH 16/19] Add the test things --- src/Tasks/Common/Resources/xlf/Strings.cs.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.de.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.es.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.fr.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.it.xlf | 4 +- .../xlf/Strings.it.xlf~RF30a3de88.TMP | 979 ++++++++++++++++++ src/Tasks/Common/Resources/xlf/Strings.ja.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.ko.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.pl.xlf | 4 +- .../Common/Resources/xlf/Strings.pt-BR.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.ru.xlf | 4 +- src/Tasks/Common/Resources/xlf/Strings.tr.xlf | 4 +- .../Common/Resources/xlf/Strings.zh-Hans.xlf | 4 +- .../Common/Resources/xlf/Strings.zh-Hant.xlf | 4 +- ...GivenThatWeWantToBuildASelfContainedApp.cs | 115 +- .../Commands/PublishCommand.cs | 10 +- .../ProjectConstruction/TestProject.cs | 23 +- .../GivenDotnetPublishPublishesProjects.cs | 58 +- 18 files changed, 1117 insertions(+), 120 deletions(-) create mode 100644 src/Tasks/Common/Resources/xlf/Strings.it.xlf~RF30a3de88.TMP diff --git a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf index 6695d0df3263..eb9a1f51a9ff 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.cs.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.cs.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.de.xlf b/src/Tasks/Common/Resources/xlf/Strings.de.xlf index 8964e78fd6ef..fb5ba008fdf8 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.de.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.de.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.es.xlf b/src/Tasks/Common/Resources/xlf/Strings.es.xlf index e50b33662e4a..d0b297e8ddf9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.es.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.es.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf index 93bb798b7bf5..bb1832dac64e 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.fr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.fr.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf b/src/Tasks/Common/Resources/xlf/Strings.it.xlf index 973cfffb0294..62f55d937c70 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.it.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.it.xlf~RF30a3de88.TMP b/src/Tasks/Common/Resources/xlf/Strings.it.xlf~RF30a3de88.TMP new file mode 100644 index 000000000000..3402c4a90125 --- /dev/null +++ b/src/Tasks/Common/Resources/xlf/Strings.it.xlf~RF30a3de88.TMP @@ -0,0 +1,979 @@ + + + + + + NETSDK1076: AddResource can only be used with integer resource types. + NETSDK1076: è possibile usare AddResource solo con tipi di risorsa integer. + {StrBegin="NETSDK1076: "} + + + NETSDK1183: Unable to optimize assemblies for Ahead of time compilation: a valid runtime package was not found. Either set the PublishAot property to false, or use a supported runtime identifier when publishing. When targeting .NET 7 or higher, make sure to restore packages with the PublishAot property set to true. + NETSDK1183: non è possibile ottimizzare gli assembly per la compilazione Ahead Of Time perché non è stato trovato alcun pacchetto di runtime valido. Impostare la proprietà PublishAot su false oppure usare un identificatore di runtime supportato durante la pubblicazione. Quando si usa .NET 7 o versioni successive, assicurarsi di ripristinare i pacchetti con la proprietà PublishAot impostata su true. + {StrBegin="NETSDK1183: "} + + + NETSDK1070: The application configuration file must have root configuration element. + NETSDK1070: il file di configurazione dell'applicazione deve avere un elemento di configurazione radice. + {StrBegin="NETSDK1070: "} + + + NETSDK1113: Failed to create apphost (attempt {0} out of {1}): {2} + NETSDK1113: non è stato possibile creare apphost (tentativo {0} di {1}): {2} + {StrBegin="NETSDK1113: "} + + + NETSDK1074: The application host executable will not be customized because adding resources requires that the build be performed on Windows (excluding Nano Server). + NETSDK1074: l'eseguibile dell'host applicazione non verrà personalizzato perché per aggiungere risorse è necessario eseguire la compilazione in Windows (escluso Nano Server). + {StrBegin="NETSDK1074: "} + + + NETSDK1029: Unable to use '{0}' as application host executable as it does not contain the expected placeholder byte sequence '{1}' that would mark where the application name would be written. + NETSDK1029: non è possibile usare '{0}' come eseguibile host dell'applicazione perché non contiene la sequenza di byte segnaposto prevista '{1}' che indica dove verrà scritto il nome dell'applicazione. + {StrBegin="NETSDK1029: "} + + + NETSDK1078: Unable to use '{0}' as application host executable because it's not a Windows PE file. + NETSDK1078: non è possibile usare '{0}' come eseguibile dell'host applicazione perché non è un file di Windows PE. + {StrBegin="NETSDK1078: "} + + + NETSDK1072: Unable to use '{0}' as application host executable because it's not a Windows executable for the CUI (Console) subsystem. + NETSDK1072: non è possibile usare '{0}' come eseguibile dell'host applicazione perché non è un eseguibile Windows per il sottosistema CUI (Console). + {StrBegin="NETSDK1072: "} + + + NETSDK1177: Failed to sign apphost with error code {1}: {0} + NETSDK1177: impossibile firmare apphost con codice di errore {1}: {0} + {StrBegin="NETSDK1177: "} + + + NETSDK1079: The Microsoft.AspNetCore.All package is not supported when targeting .NET Core 3.0 or higher. A FrameworkReference to Microsoft.AspNetCore.App should be used instead, and will be implicitly included by Microsoft.NET.Sdk.Web. + NETSDK1079: il pacchetto Microsoft.AspNetCore.All non è supportato quando la destinazione è .NET Core 3.0 o versione successiva. È necessario un elemento FrameworkReference per Microsoft.AspNetCore.App, che verrà incluso in modo implicito da Microsoft.NET.Sdk.Web. + {StrBegin="NETSDK1079: "} + + + NETSDK1080: A PackageReference to Microsoft.AspNetCore.App is not necessary when targeting .NET Core 3.0 or higher. If Microsoft.NET.Sdk.Web is used, the shared framework will be referenced automatically. Otherwise, the PackageReference should be replaced with a FrameworkReference. + NETSDK1080: non è necessario alcun elemento PackageReference per Microsoft.AspNetCore.App quando la destinazione è .NET Core 3.0 o versione successiva. Se si usa Microsoft.NET.Sdk.Web, il riferimento al framework condiviso verrà inserito automaticamente; in caso contrario, l'elemento PackageReference deve essere sostituito da un elemento FrameworkReference. + {StrBegin="NETSDK1080: "} + + + NETSDK1017: Asset preprocessor must be configured before assets are processed. + NETSDK1017: prima di elaborare le risorse, è necessario configurare il preprocessore di risorse. + {StrBegin="NETSDK1017: "} + + + NETSDK1047: Assets file '{0}' doesn't have a target for '{1}'. Ensure that restore has run and that you have included '{2}' in the TargetFrameworks for your project. You may also need to include '{3}' in your project's RuntimeIdentifiers. + NETSDK1047: il file di risorse '{0}' non contiene una destinazione per '{1}'. Assicurarsi che il ripristino sia stato eseguito e che '{2}' sia stato incluso negli elementi TargetFramework del progetto. Potrebbe anche essere necessario includere '{3}' negli elementi RuntimeIdentifier del progetto. + {StrBegin="NETSDK1047: "} + + + NETSDK1005: Assets file '{0}' doesn't have a target for '{1}'. Ensure that restore has run and that you have included '{2}' in the TargetFrameworks for your project. + NETSDK1005: il file di risorse '{0}' non contiene una destinazione per '{1}'. Assicurarsi che il ripristino sia stato eseguito e che '{2}' sia stato incluso negli elementi TargetFramework del progetto. + {StrBegin="NETSDK1005: "} + + + NETSDK1004: Assets file '{0}' not found. Run a NuGet package restore to generate this file. + NETSDK1004: il file di risorse '{0}' non è stato trovato. Per generare questo file, eseguire un ripristino del pacchetto NuGet. + {StrBegin="NETSDK1004: "} + + + NETSDK1063: The path to the project assets file was not set. Run a NuGet package restore to generate this file. + NETSDK1063: il percorso del file di risorse del progetto non è stato impostato. Per generare questo file, eseguire un ripristino del pacchetto NuGet. + {StrBegin="NETSDK1063: "} + + + NETSDK1006: Assets file path '{0}' is not rooted. Only full paths are supported. + NETSDK1006: il percorso dei file di risorse '{0}' non contiene una radice. Sono supportati solo percorsi completi. + {StrBegin="NETSDK1006: "} + + + NETSDK1001: At least one possible target framework must be specified. + NETSDK1001: è necessario specificare almeno un framework di destinazione possibile. + {StrBegin="NETSDK1001: "} + + + NETSDK1092: The CLSIDMap cannot be embedded on the COM host because adding resources requires that the build be performed on Windows (excluding Nano Server). + NETSDK1092: non è possibile incorporare l'elemento CLSIDMap nell'host COM perché per aggiungere risorse è necessario eseguire la compilazione in Windows (escluso Nano Server). + {StrBegin="NETSDK1092: "} + + + NETSDK1065: Cannot find app host for {0}. {0} could be an invalid runtime identifier (RID). For more information about RID, see https://aka.ms/rid-catalog. + NETSDK1065: non è possibile trovare l'host delle app per {0}. {0} potrebbe essere un identificatore di runtime (RID) non valido. Per altre informazioni sul RID, vedere https://aka.ms/rid-catalog. + {StrBegin="NETSDK1065: "} + + + NETSDK1091: Unable to find a .NET Core COM host. The .NET Core COM host is only available on .NET Core 3.0 or higher when targeting Windows. + NETSDK1091: non è possibile trovare un host COM .NET Core. L'host COM .NET Core è disponibile solo in .NET Core 3.0 o versioni successive quando è destinato a Windows. + {StrBegin="NETSDK1091: "} + + + NETSDK1114: Unable to find a .NET Core IJW host. The .NET Core IJW host is only available on .NET Core 3.1 or higher when targeting Windows. + NETSDK1114: non è possibile trovare un host IJW .NET Core. L'host IJW .NET Core è disponibile solo in .NET Core 3.1 o versioni successive quando la destinazione è Windows. + {StrBegin="NETSDK1114: "} + + + NETSDK1007: Cannot find project info for '{0}'. This can indicate a missing project reference. + NETSDK1007: le informazioni del progetto per '{0}' non sono state trovate. Questo errore può indicare la mancanza di un riferimento al progetto. + {StrBegin="NETSDK1007: "} + + + NETSDK1032: The RuntimeIdentifier platform '{0}' and the PlatformTarget '{1}' must be compatible. + NETSDK1032: la piattaforma '{0}' di RuntimeIdentifier e quella '{1}' di PlatformTarget devono essere compatibili. + {StrBegin="NETSDK1032: "} + + + NETSDK1031: It is not supported to build or publish a self-contained application without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set SelfContained to false. + NETSDK1031: non è possibile compilare o pubblicare un'applicazione indipendente senza specificare un elemento RuntimeIdentifier. Specificare un elemento RuntimeIdentifier o impostare SelfContained su false. + {StrBegin="NETSDK1031: "} + + + NETSDK1097: It is not supported to publish an application to a single-file without specifying a RuntimeIdentifier. You must either specify a RuntimeIdentifier or set PublishSingleFile to false. + NETSDK1097: non è possibile pubblicare un'applicazione in un singolo file senza specificare un elemento RuntimeIdentifier. Specificare un elemento RuntimeIdentifier o impostare PublishSingleFile su false. + {StrBegin="NETSDK1097: "} + + + NETSDK1098: Applications published to a single-file are required to use the application host. You must either set PublishSingleFile to false or set UseAppHost to true. + NETSDK1098: le applicazioni pubblicate in un singolo file sono necessarie per usare l'host dell'applicazione. Impostare PublishSingleFile su false o UseAppHost su true. + {StrBegin="NETSDK1098: "} + + + NETSDK1099: Publishing to a single-file is only supported for executable applications. + NETSDK1099: la pubblicazione in un singolo file è supportata solo per le applicazioni eseguibili. + {StrBegin="NETSDK1099: "} + + + NETSDK1134: Building a solution with a specific RuntimeIdentifier is not supported. If you would like to publish for a single RID, specifiy the RID at the individual project level instead. + NETSDK1134: non è possibile compilare una soluzione con un parametro RuntimeIdentifier specifico. Per pubblicare per un singolo RID, specificare il RID a livello di singolo progetto. + {StrBegin="NETSDK1134: "} + + + NETSDK1135: SupportedOSPlatformVersion {0} cannot be higher than TargetPlatformVersion {1}. + NETSDK1135: il valore di SupportedOSPlatformVersion {0} non può essere maggiore di quello di TargetPlatformVersion {1}. + {StrBegin="NETSDK1135: "} + + + NETSDK1143: Including all content in a single file bundle also includes native libraries. If IncludeAllContentForSelfExtract is true, IncludeNativeLibrariesForSelfExtract must not be false. + NETSDK1143: se si include tutto il contenuto in un unico bundle di file, verranno incluse anche le librerie native. Se IncludeAllContentForSelfExtract è true, IncludeNativeLibrariesForSelfExtract non deve essere false. + {StrBegin="NETSDK1143: "} + + + NETSDK1142: Including symbols in a single file bundle is not supported when publishing for .NET5 or higher. + NETSDK1142: l'inclusione dei simboli in un unico bundle di file non è supportata quando si esegue la pubblicazione per .NET 5 o versioni successive. + {StrBegin="NETSDK1142: "} + + + NETSDK1013: The TargetFramework value '{0}' was not recognized. It may be misspelled. If not, then the TargetFrameworkIdentifier and/or TargetFrameworkVersion properties must be specified explicitly. + NETSDK1013: il valore {0}' di TargetFramework non è stato riconosciuto. È possibile che sia stato digitato in modo errato. In caso contrario, le proprietà TargetFrameworkIdentifier e/o TargetFrameworkVersion devono essere specificate in modo esplicito. + {StrBegin="NETSDK1013: "} + + + NETSDK1067: Self-contained applications are required to use the application host. Either set SelfContained to false or set UseAppHost to true. + NETSDK1067: con le applicazioni complete è necessario usare l'host applicazione. Impostare SelfContained su false o UseAppHost su true. + {StrBegin="NETSDK1067: "} + + + NETSDK1125: Publishing to a single-file is only supported for netcoreapp target. + NETSDK1125: la pubblicazione in un file singolo è supportata solo per la destinazione netcoreapp. + {StrBegin="NETSDK1125: "} + + + Choosing '{0}' because AssemblyVersion '{1}' is greater than '{2}'. + Verrà scelto '{0}' perché il valore di AssemblyVersion '{1}' è maggiore di '{2}'. + + + + Choosing '{0}' arbitrarily as both items are copy-local and have equal file and assembly versions. + Verrà scelto '{0}' in modo arbitrario perché entrambi gli elementi sono una copia locale e contengono versioni di file e assembly uguali. + + + + Choosing '{0}' because file version '{1}' is greater than '{2}'. + Verrà scelto '{0}' perché la versione del file '{1}' è maggiore di '{2}'. + + + + Choosing '{0}' because it is a platform item. + Verrà scelto '{0}' perché è un elemento della piattaforma. + + + + Choosing '{0}' because it comes from a package that is preferred. + Verrà scelto '{0}' perché proviene da un pacchetto preferito. + + + + NETSDK1089: The '{0}' and '{1}' types have the same CLSID '{2}' set in their GuidAttribute. Each COMVisible class needs to have a distinct guid for their CLSID. + NETSDK1089: per i tipi '{0}' e '{1}' è impostato lo stesso CLSID '{2}' nel relativo elemento GuidAttribute. Ogni classe COMVisible deve includere un GUID distinto per il CLSID. + {StrBegin="NETSDK1089: "} +{0} - The first type with the conflicting guid. +{1} - The second type with the conflicting guid. +{2} - The guid the two types have. + + + NETSDK1088: The COMVisible class '{0}' must have a GuidAttribute with the CLSID of the class to be made visible to COM in .NET Core. + NETSDK1088: la classe COMVisible '{0}' deve includere un elemento GuidAttribute con il CLSID della classe da rendere visibile per COM in .NET Core. + {StrBegin="NETSDK1088: "} +{0} - The ComVisible class that doesn't have a GuidAttribute on it. + + + NETSDK1090: The supplied assembly '{0}' is not valid. Cannot generate a CLSIDMap from it. + NETSDK1090: l'assembly specificato '{0}' non è valido. Non può essere usato per generare un elemento CLSIDMap. + {StrBegin="NETSDK1090: "} +{0} - The path to the invalid assembly. + + + NETSDK1167: Compression in a single file bundle is only supported when publishing for .NET6 or higher. + NETSDK1167: la compressione in un unico bundle di file è supportata solo quando si esegue la pubblicazione per .NET6 o versioni successive. + {StrBegin="NETSDK1167: "} + + + NETSDK1176: Compression in a single file bundle is only supported when publishing a self-contained application. + NETSDK1176: la compressione in un unico bundle di file è supportata solo quando si esegue la pubblicazione di un'applicazione indipendente. + {StrBegin="NETSDK1176: "} + + + NETSDK1133: There was conflicting information about runtime packs available for {0}: +{1} + NETSDK1133: sono presenti informazioni in conflitto sui pacchetti di runtime disponibili per {0}: +{1} + {StrBegin="NETSDK1133: "} + + + NETSDK1014: Content item for '{0}' sets '{1}', but does not provide '{2}' or '{3}'. + NETSDK1014: l'elemento di contenuto per '{0}' imposta '{1}', ma non fornisce '{2}' o '{3}'. + {StrBegin="NETSDK1014: "} + + + NETSDK1010: The '{0}' task must be given a value for parameter '{1}' in order to consume preprocessed content. + NETSDK1010: per poter utilizzare il contenuto pre-elaborato, è necessario assegnare un valore per il parametro '{1}' nell'attività '{0}'. + {StrBegin="NETSDK1010: "} + + + Could not determine winner because '{0}' does not exist. + Non è stato possibile determinare la versione da usare perché '{0}' non esiste. + + + + Could not determine winner due to equal file and assembly versions. + Non è stato possibile determinare la versione da usare perché le versioni dell'assembly e del file sono uguali. + + + + Could not determine a winner because '{0}' has no file version. + Non è stato possibile determinare la versione da usare perché non esiste alcuna versione del file per '{0}'. + + + + Could not determine a winner because '{0}' is not an assembly. + Non è stato possibile determinare la versione da usare perché '{0}' non è un assembly. + + + + NETSDK1181: Error getting pack version: Pack '{0}' was not present in workload manifests. + NETSDK1181: errore durante il recupero della versione del pacchetto: il pacchetto '{0}' non era presente nei manifesti del carico di lavoro. + {StrBegin="NETSDK1181: "} + + + NETSDK1042: Could not load PlatformManifest from '{0}' because it did not exist. + NETSDK1042: non è stato possibile caricare PlatformManifest da '{0}' perché non esiste. + {StrBegin="NETSDK1042: "} + + + NETSDK1120: C++/CLI projects targeting .NET Core require a target framework of at least 'netcoreapp3.1'. + NETSDK1120: con i progetti C++/CLI destinati a .NET Core è il framework di destinazione deve essere impostato almeno su 'netcoreapp3.1'. + {StrBegin="NETSDK1120: "} + + + NETSDK1158: Required '{0}' metadata missing on Crossgen2Tool item. + NETSDK1158: nell'elemento Crossgen2Tool mancano i metadati richiesti di '{0}'. + {StrBegin="NETSDK1158: "} + + + NETSDK1126: Publishing ReadyToRun using Crossgen2 is only supported for self-contained applications. + NETSDK1126: la pubblicazione di ReadyToRun tramite Crossgen2 è supportata solo per le applicazioni autonome. + {StrBegin="NETSDK1126: "} + + + NETSDK1155: Crossgen2Tool executable '{0}' not found. + NETSDK1155: l'eseguibile '{0}' di Crossgen2Tool non è stato trovato. + {StrBegin="NETSDK1155: "} + + + NETSDK1154: Crossgen2Tool must be specified when UseCrossgen2 is set to true. + NETSDK1154: è necessario specificare Crossgen2Tool quando UseCrossgen2 è impostato su true. + {StrBegin="NETSDK1154: "} + + + NETSDK1166: Cannot emit symbols when publishing for .NET 5 with Crossgen2 using composite mode. + NETSDK1166: non è possibile creare simboli durante la pubblicazione per .NET 5 con Crossgen2 usando la modalità composita. + {StrBegin="NETSDK1166: "} + + + NETSDK1160: CrossgenTool executable '{0}' not found. + NETSDK1160: l'eseguibile '{0}' di CrossgenTool non è stato trovato. + {StrBegin="NETSDK1160: "} + + + NETSDK1153: CrossgenTool not specified in PDB compilation mode. + NETSDK1153: CrossgenTool non è stato specificato nella modalità di compilazione PDB. + {StrBegin="NETSDK1153: "} + + + NETSDK1159: CrossgenTool must be specified when UseCrossgen2 is set to false. + NETSDK1159: è necessario specificare CrossgenTool quando UseCrossgen2 è impostato su false. + {StrBegin="NETSDK1159: "} + + + NETSDK1161: DiaSymReader library '{0}' not found. + NETSDK1161: la libreria '{0}' di DiaSymReader non è stata trovata. + {StrBegin="NETSDK1161: "} + + + NETSDK1156: .NET host executable '{0}' not found. + NETSDK1156: l'eseguibile '{0}' dell'host .NET non è stato trovato. + {StrBegin="NETSDK1156: "} + + + NETSDK1055: DotnetTool does not support target framework lower than netcoreapp2.1. + NETSDK1055: DotnetTool non supporta framework di destinazione di versioni precedenti a netcoreapp2.1. + {StrBegin="NETSDK1055: "} + + + NETSDK1054: only supports .NET Core. + NETSDK1054: supporta solo .NET Core. + {StrBegin="NETSDK1054: "} + + + NETSDK1022: Duplicate '{0}' items were included. The .NET SDK includes '{0}' items from your project directory by default. You can either remove these items from your project file, or set the '{1}' property to '{2}' if you want to explicitly include them in your project file. For more information, see {4}. The duplicate items were: {3} + NETSDK1022: sono stati inclusi '{0}' elementi duplicati. Per impostazione predefinita, .NET SDK include '{0}' elementi della directory del progetto. È possibile rimuovere tali elementi dal file di progetto oppure impostare la proprietà '{1}' su '{2}' se si vuole includerli implicitamente nel file di progetto. Per altre informazioni, vedere {4}. Gli elementi duplicati sono: {3} + {StrBegin="NETSDK1022: "} + + + NETSDK1015: The preprocessor token '{0}' has been given more than one value. Choosing '{1}' as the value. + NETSDK1015: al token di preprocessore '{0}' è stato assegnato più di un valore. Come valore verrà scelto '{1}'. + {StrBegin="NETSDK1015: "} + + + NETSDK1152: Found multiple publish output files with the same relative path: {0}. + NETSDK1152: sono stati trovati più file di output di pubblicazione con lo stesso percorso relativo: {0}. + {StrBegin="NETSDK1152: "} + + + NETSDK1110: More than one asset in the runtime pack has the same destination sub-path of '{0}'. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. + NETSDK1110: più di un asset nel pacchetto di runtime ha lo stesso percorso secondario di destinazione di '{0}'. Segnalare questo errore al team di .NET all'indirizzo: https://aka.ms/dotnet-sdk-issue. + {StrBegin="NETSDK1110: "} + + + NETSDK1169: The same resource ID {0} was specified for two type libraries '{1}' and '{2}'. Duplicate type library IDs are not allowed. + NETSDK1169: è stato specificato lo stesso ID di risorsa {0} per due librerie dei tipi '{1}' e '{2}'. Gli ID della libreria dei tipi duplicati non sono consentiti. + {StrBegin="NETSDK1169: "} + + + Encountered conflict between '{0}' and '{1}'. + È stato rilevato un conflitto tra '{0}' e '{1}'. + + + + NETSDK1051: Error parsing FrameworkList from '{0}'. {1} '{2}' was invalid. + NETSDK1051: si è verificato un errore durante l'analisi di FrameworkList da '{0}'. {1} '{2}' non è valido. + {StrBegin="NETSDK1051: "} + + + NETSDK1043: Error parsing PlatformManifest from '{0}' line {1}. Lines must have the format {2}. + NETSDK1043: si è verificato un errore durante l'analisi di PlatformManifest da '{0}' a riga {1}. Il formato delle righe deve essere {2}. + {StrBegin="NETSDK1043: "} + + + NETSDK1044: Error parsing PlatformManifest from '{0}' line {1}. {2} '{3}' was invalid. + NETSDK1044: si è verificato un errore durante l'analisi di PlatformManifest da '{0}' a riga {1}. Il valore {2} '{3}' non è valido. + {StrBegin="NETSDK1044: "} + + + NETSDK1060: Error reading assets file: {0} + NETSDK1060: errore durante la lettura del file di asset: {0} + {StrBegin="NETSDK1060: "} + + + NETSDK1111: Failed to delete output apphost: {0} + NETSDK1111: non è stato possibile eliminare l'apphost di output: {0} + {StrBegin="NETSDK1111: "} + + + NETSDK1077: Failed to lock resource. + NETSDK1077: non è stato possibile bloccare la risorsa. + {StrBegin="NETSDK1077: "} + + + NETSDK1030: Given file name '{0}' is longer than 1024 bytes + NETSDK1030: il nome file specificato '{0}' supera 1024 byte + {StrBegin="NETSDK1030: "} + + + NETSDK1024: Folder '{0}' already exists either delete it or provide a different ComposeWorkingDir + NETSDK1024: la cartella '{0}' esiste già. Eliminarla o specificare un elemento ComposeWorkingDir diverso + {StrBegin="NETSDK1024: "} + + + NETSDK1068: The framework-dependent application host requires a target framework of at least 'netcoreapp2.1'. + NETSDK1068: con l'host applicazione dipendente dal framework il framework di destinazione deve essere impostato almeno su 'netcoreapp2.1'. + {StrBegin="NETSDK1068: "} + + + NETSDK1052: Framework list file path '{0}' is not rooted. Only full paths are supported. + NETSDK1052: il percorso '{0}' del file dell'elenco di framework non contiene una radice. Sono supportati solo percorsi completi. + {StrBegin="NETSDK1052: "} + + + NETSDK1087: Multiple FrameworkReference items for '{0}' were included in the project. + NETSDK1087: nel progetto sono stati inclusi più elementi FrameworkReference per '{0}'. + {StrBegin="NETSDK1087: "} + + + NETSDK1086: A FrameworkReference for '{0}' was included in the project. This is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see {1} + NETSDK1086: nel progetto è stato incluso un elemento FrameworkReference per '{0}'. Questo elemento viene usato come riferimento implicito da .NET SDK e non è in genere necessario farvi riferimento dal progetto. Per altre informazioni, vedere {1} + {StrBegin="NETSDK1086: "} + + + NETSDK1049: Resolved file has a bad image, no metadata, or is otherwise inaccessible. {0} {1} + NETSDK1049: il file risolto ha un'immagine danneggiata, non contiene metadati o è inaccessibile per altri motivi. {0} {1} + {StrBegin="NETSDK1049: "} + + + NETSDK1141: Unable to resolve the .NET SDK version as specified in the global.json located at {0}. + NETSDK1141: non è possibile risolvere la versione di .NET SDK come specificato nel file global.json presente in {0}. + {StrBegin="NETSDK1141: "} + + + NETSDK1144: Optimizing assemblies for size failed. Optimization can be disabled by setting the PublishTrimmed property to false. + NETSDK1144: l'ottimizzazione degli assembly per le dimensioni non è riuscita. È possibile disabilitare l'ottimizzazione impostando la proprietà PublishTrimmed su false. + {StrBegin="NETSDK1144: "} + + + NETSDK1102: Optimizing assemblies for size is not supported for the selected publish configuration. Please ensure that you are publishing a self-contained app. + NETSDK1102: l'ottimizzazione degli assembly per le dimensioni non è supportata per la configurazione di pubblicazione selezionata. Assicurarsi di pubblicare un'app indipendente. + {StrBegin="NETSDK1102: "} + + + Optimizing assemblies for size may change the behavior of the app. Be sure to test after publishing. See: https://aka.ms/dotnet-illink + L'ottimizzazione degli assembly per le dimensioni potrebbe comportare la modifica del comportamento dell'app. Assicurarsi di testarla dopo la pubblicazione. Vedere: https://aka.ms/dotnet-illink + + + + Optimizing assemblies for size. This process might take a while. + Ottimizzazione degli assembly per le dimensioni. Questo processo potrebbe richiedere del tempo. + + + + NETSDK1191: A runtime identifier for the property '{0}' couldn't be inferred. Specify a rid explicitly. + NETSDK1191: non è stato possibile dedurre un identificatore di runtime per la proprietà '{0}'. Specificare un RID in modo esplicito. + {StrBegin="NETSDK1191: "} + + + NETSDK1020: Package Root {0} was incorrectly given for Resolved library {1} + NETSDK1020: la radice {0} del pacchetto specificata per la libreria risolta {1} non è corretta + {StrBegin="NETSDK1020: "} + + + NETSDK1025: The target manifest {0} provided is of not the correct format + NETSDK1025: il formato del manifesto di destinazione specificato {0} non è corretto + {StrBegin="NETSDK1025: "} + + + NETSDK1163: Input assembly '{0}' not found. + NETSDK1163: l'assembly di input '{0}' non è stato trovato. + {StrBegin="NETSDK1163: "} + + + NETSDK1003: Invalid framework name: '{0}'. + NETSDK1003: nome di framework non valido: '{0}'. + {StrBegin="NETSDK1003: "} + + + NETSDK1058: Invalid value for ItemSpecToUse parameter: '{0}'. This property must be blank or set to 'Left' or 'Right' + NETSDK1058: valore non valido per il parametro ItemSpecToUse: '{0}'. Questa proprietà deve essere vuota o impostata su 'Left' o 'Right' + {StrBegin="NETSDK1058: "} +The following are names of parameters or literal values and should not be translated: ItemSpecToUse, Left, Right + + + NETSDK1018: Invalid NuGet version string: '{0}'. + NETSDK1018: la stringa di versione '{0}' di NuGet non è valida. + {StrBegin="NETSDK1018: "} + + + NETSDK1075: Update handle is invalid. This instance may not be used for further updates. + NETSDK1075: il punto di controllo dell'aggiornamento non è valido. Non è possibile usare questa istanza per ulteriori aggiornamenti. + {StrBegin="NETSDK1075: "} + + + NETSDK1104: RollForward value '{0}' is invalid. Allowed values are {1}. + NETSDK1104: il valore '{0}' di RollForward non è valido. I valori consentiti sono {1}. + {StrBegin="NETSDK1104: "} + + + NETSDK1140: {0} is not a valid TargetPlatformVersion for {1}. Valid versions include: +{2} + NETSDK1140: {0} non è un valore valido di TargetPlatformVersion per or {1}. Le versioni valide includono: +{2} + {StrBegin="NETSDK1140: "} + + + NETSDK1173: The provided type library '{0}' is in an invalid format. + NETSDK1173: il formato della libreria dei tipi specificata '{0}' non è valido. + {StrBegin="NETSDK1173: "} + + + NETSDK1170: The provided type library ID '{0}' for type library '{1}' is invalid. The ID must be a positive integer less than 65536. + NETSDK1170: l'ID '{0}' per la libreria dei tipi specificato '{1}' non è valido. L'ID deve essere un numero positivo intero inferiore a 65536. + {StrBegin="NETSDK1170: "} + + + NETSDK1157: JIT library '{0}' not found. + NETSDK1157: la libreria '{0}' di JIT non è stata trovata. + {StrBegin="NETSDK1157: "} + + + NETSDK1061: The project was restored using {0} version {1}, but with current settings, version {2} would be used instead. To resolve this issue, make sure the same settings are used for restore and for subsequent operations such as build or publish. Typically this issue can occur if the RuntimeIdentifier property is set during build or publish but not during restore. For more information, see https://aka.ms/dotnet-runtime-patch-selection. + NETSDK1061: per il ripristino del progetto è stato usato {0} versione {1}, ma con le impostazioni correnti viene usata la versione {2}. Per risolvere il problema, assicurarsi di usare le stesse impostazioni per il ripristino e per le operazioni successive, quali compilazione o pubblicazione. In genere questo problema può verificarsi se la proprietà RuntimeIdentifier viene impostata durante la compilazione o la pubblicazione, ma non durante il ripristino. Per altre informazioni, vedere https://aka.ms/dotnet-runtime-patch-selection. + {StrBegin="NETSDK1061: "} +{0} - Package Identifier for platform package +{1} - Restored version of platform package +{2} - Current version of platform package + + + NETSDK1008: Missing '{0}' metadata on '{1}' item '{2}'. + NETSDK1008: mancano i metadati di '{0}' sull'elemento '{2}' di '{1}'. + {StrBegin="NETSDK1008: "} + + + NETSDK1164: Missing output PDB path in PDB generation mode (OutputPDBImage metadata). + NETSDK1164: il percorso PDB di output non è presente nella modalità di generazione PDB (metadati di OutputPDBImage). + {StrBegin="NETSDK1164: "} + + + NETSDK1165: Missing output R2R image path (OutputR2RImage metadata). + NETSDK1165: il percorso dell'immagine R2R di output non è presente (metadati di OutputR2RImage). + {StrBegin="NETSDK1165: "} + + + NETSDK1171: An integer ID less than 65536 must be provided for type library '{0}' because more than one type library is specified. + NETSDK1171: un ID intero inferiore a 65536 deve essere fornito per la libreria dei tipi '{0}' perché è specificata più di una libreria dei tipi. + {StrBegin="NETSDK1171: "} + + + NETSDK1021: More than one file found for {0} + NETSDK1021: è stato trovato più di un file per {0} + {StrBegin="NETSDK1021: "} + + + NETSDK1069: This project uses a library that targets .NET Standard 1.5 or higher, and the project targets a version of .NET Framework that doesn't have built-in support for that version of .NET Standard. Visit https://aka.ms/net-standard-known-issues for a set of known issues. Consider retargeting to .NET Framework 4.7.2. + NETSDK1069: questo progetto usa una libreria destinata a .NET Standard 1.5 o versione successiva ed è destinato a una versione di .NET Framework che non include il supporto predefinito per tale versione di .NET Standard. Per un serie di problemi noti, visitare https://aka.ms/net-standard-known-issues. Provare a impostare come destinazione .NET Framework 4.7.2. + {StrBegin="NETSDK1069: "} + + + NETSDK1115: The current .NET SDK does not support .NET Framework without using .NET SDK Defaults. It is likely due to a mismatch between C++/CLI project CLRSupport property and TargetFramework. + NETSDK1115: l'istanza corrente di .NET SDK non supporta .NET Framework senza usare le impostazioni predefinite di .NET SDK. Il problema dipende probabilmente da una mancata corrispondenza tra la proprietà CLRSupport del progetto C++/CLI e TargetFramework. + {StrBegin="NETSDK1115: "} + + + NETSDK1182: Targeting .NET 6.0 or higher in Visual Studio 2019 is not supported. + NETSDK1182: la destinazione .NET 6.0 o versione successiva in Visual Studio 2019 non è supportata. + {StrBegin="NETSDK1182: "} + + + NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported. + NETSDK1192: Targeting .NET 7.0 or higher in Visual Studio 2022 17.3 is not supported. + {StrBegin="NETSDK1192: "} + + + NETSDK1084: There is no application host available for the specified RuntimeIdentifier '{0}'. + NETSDK1084: non è disponibile alcun host applicazione per l'elemento RuntimeIdentifier specificato '{0}'. + {StrBegin="NETSDK1084: "} + + + NETSDK1085: The 'NoBuild' property was set to true but the 'Build' target was invoked. + NETSDK1085: non è stata impostata alcuna proprietà 'NoBuild' su true, ma è stata chiamata la destinazione 'Build'. + {StrBegin="NETSDK1085: "} + + + NETSDK1002: Project '{0}' targets '{2}'. It cannot be referenced by a project that targets '{1}'. + NETSDK1002: il progetto '{0}' è destinato a '{2}'. Non può essere usato come riferimento in un progetto destinato a '{1}'. + {StrBegin="NETSDK1002: "} + + + NETSDK1082: There was no runtime pack for {0} available for the specified RuntimeIdentifier '{1}'. + NETSDK1082: non è disponibile alcun pacchetto di runtime per {0} per l'elemento RuntimeIdentifier specificato '{1}'. + {StrBegin="NETSDK1082: "} + + + NETSDK1132: No runtime pack information was available for {0}. + NETSDK1132: non sono disponibili informazioni sui pacchetti di runtime per {0}. + {StrBegin="NETSDK1132: "} + + + NETSDK1128: COM hosting does not support self-contained deployments. + NETSDK1128: l'hosting COM non supporta le distribuzioni complete. + {StrBegin="NETSDK1128: "} + + + NETSDK1119: C++/CLI projects targeting .NET Core cannot use EnableComHosting=true. + NETSDK1119: i progetti C++/CLI destinati a .NET Core non possono usare EnableComHosting=true. + {StrBegin="NETSDK1119: "} + + + NETSDK1116: C++/CLI projects targeting .NET Core must be dynamic libraries. + NETSDK1116: i progetti C++/CLI destinati a .NET Core devono essere librerie dinamiche. + {StrBegin="NETSDK1116: "} + + + NETSDK1118: C++/CLI projects targeting .NET Core cannot be packed. + NETSDK1118: i progetti C++/CLI destinati a .NET Core non possono essere compressi. + {StrBegin="NETSDK1118: "} + + + NETSDK1117: Does not support publish of C++/CLI project targeting dotnet core. + NETSDK1117: la pubblicazione di progetti C++/CLI destinati a .NET Core non è supportata. + {StrBegin="NETSDK1117: "} + + + NETSDK1121: C++/CLI projects targeting .NET Core cannot use SelfContained=true. + NETSDK1121: i progetti C++/CLI destinati a .NET Core non possono usare SelfContained=true. + {StrBegin="NETSDK1121: "} + + + NETSDK1151: The referenced project '{0}' is a self-contained executable. A self-contained executable cannot be referenced by a non self-contained executable. For more information, see https://aka.ms/netsdk1151 + NETSDK1151: il progetto '{0}' a cui viene fatto riferimento è un eseguibile autonomo. Non è possibile fare riferimento a un eseguibile autonomo da un eseguibile non autonomo. Per altre informazioni, vedere https://aka.ms/netsdk1151 + {StrBegin="NETSDK1151: "} + + + NETSDK1162: PDB generation: R2R executable '{0}' not found. + NETSDK1162: generazione PDB: l'eseguibile '{0}' di R2R non è stato trovato. + {StrBegin="NETSDK1162: "} + + + NETSDK1190: To use '{0}' in solution projects, you must set the environment variable '{1}' (to true). This will increase the time to complete the operation. + NETSDK1190: per usare '{0}' nei progetti di soluzione, è necessario impostare la variabile di ambiente '{1}' (su true). Ciò aumenterà il tempo necessario per completare l'operazione. + {StrBegin="NETSDK1190: "} + + + NETSDK1053: Pack as tool does not support self contained. + NETSDK1053: la creazione di pacchetti come strumenti non prevede elementi autonomi. + {StrBegin="NETSDK1053: "} + + + NETSDK1146: PackAsTool does not support TargetPlatformIdentifier being set. For example, TargetFramework cannot be net5.0-windows, only net5.0. PackAsTool also does not support UseWPF or UseWindowsForms when targeting .NET 5 and higher. + NETSDK1146: PackAsTool non supporta l'impostazione di TargetPlatformIdentifier. Ad esempio, TargetFramework non può essere essere impostato su net5.0-windows, ma solo su net5.0. PackAsTool non supporta neanche UseWPF o UseWindowsForms quando la destinazione è .NET 5 e versioni successive. + {StrBegin="NETSDK1146: "} + + + NETSDK1187: Package {0} {1} has a resource with the locale '{2}'. This locale has been normalized to the standard format '{3}' to prevent casing issues in the build. Consider notifying the package author about this casing issue. + NETSDK1187: il pacchetto {0} {1} include una risorsa con le impostazioni locali '{2}'. Queste impostazioni locali sono state normalizzate nel formato standard '{3}' per evitare problemi di maiuscole e minuscole nella compilazione. È consigliabile informare l'autore del pacchetto in merito a questo problema di maiuscole e minuscole. + Error code is NETSDK1187. 0 is a package name, 1 is a package version, 2 is the incorrect locale string, and 3 is the correct locale string. + + + NETSDK1188: Package {0} {1} has a resource with the locale '{2}'. This locale is not recognized by .NET. Consider notifying the package author that it appears to be using an invalid locale. + NETSDK1188: il pacchetto {0} {1} include una risorsa con le impostazioni locali '{2}'. Queste impostazioni locali non sono riconosciute da .NET. È consigliabile notificare all'autore del pacchetto che sembra usare impostazioni locali non valide. + Error code is NETSDK1188. 0 is a package name, 1 is a package version, and 2 is the incorrect locale string + + + NETSDK1064: Package {0}, version {1} was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions. + NETSDK1064: il pacchetto {0} versione {1} non è stato trovato. Potrebbe essere stato eliminato dopo il ripristino di NuGet. In caso contrario, il ripristino di NuGet potrebbe essere stato completato solo parzialmente, a causa delle restrizioni relative alla lunghezza massima del percorso. + {StrBegin="NETSDK1064: "} + + + NETSDK1023: A PackageReference for '{0}' was included in your project. This package is implicitly referenced by the .NET SDK and you do not typically need to reference it from your project. For more information, see {1} + NETSDK1023: nel progetto è stato incluso un riferimento al pacchetto per '{0}'. Questo pacchetto viene usato come riferimento implicito da .NET SDK e non è in genere necessario farvi riferimento dal progetto. Per altre informazioni, vedere {1} + {StrBegin="NETSDK1023: "} + + + NETSDK1071: A PackageReference to '{0}' specified a Version of `{1}`. Specifying the version of this package is not recommended. For more information, see https://aka.ms/sdkimplicitrefs + NETSDK1071: in un elemento PackageReference che fa riferimento a '{0}' è specificata la versione di `{1}`. È consigliabile non specificare la versione di questo pacchetto. Per altre informazioni, vedere https://aka.ms/sdkimplicitrefs + {StrBegin="NETSDK1071: "} + + + NETSDK1174: Placeholder + NETSDK1174: Placeholder + {StrBegin="NETSDK1174: "} - This string is not used here, but is a placeholder for the error code, which is used by the "dotnet run" command. + + + NETSDK1189: Prefer32Bit is not supported and has no effect for netcoreapp target. + NETSDK1189: Prefer32Bit non è supportato e non ha alcun effetto per la destinazione netcoreapp. + {StrBegin="NETSDK1189: "} + + + NETSDK1011: Assets are consumed from project '{0}', but no corresponding MSBuild project path was found in '{1}'. + NETSDK1011: le risorse vengono utilizzate dal progetto '{0}', ma non è stato trovato alcun percorso di progetto MSBuild corrispondente in '{1}'. + {StrBegin="NETSDK1011: "} + + + NETSDK1059: The tool '{0}' is now included in the .NET SDK. Information on resolving this warning is available at (https://aka.ms/dotnetclitools-in-box). + NETSDK1059: lo strumento '{0}' è ora incluso in .NET SDK. Per informazioni sulla risoluzione di questo avviso, vedere (https://aka.ms/dotnetclitools-in-box). + {StrBegin="NETSDK1059: "} + + + NETSDK1093: Project tools (DotnetCliTool) only support targeting .NET Core 2.2 and lower. + NETSDK1093: gli strumenti del progetto (DotnetCliTool) supportano come destinazione solo .NET Core 2.2 e versioni precedenti. + {StrBegin="NETSDK1093: "} + + + NETSDK1122: ReadyToRun compilation will be skipped because it is only supported for .NET Core 3.0 or higher. + NETSDK1122: la compilazione eseguita con ReadyToRun verrà ignorata perché è supportata solo per .NET Core 3.0 o versioni successive. + {StrBegin="NETSDK1122: "} + + + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + {StrBegin="NETSDK1193: "} + + + NETSDK1123: Publishing an application to a single-file requires .NET Core 3.0 or higher. + NETSDK1123: per la pubblicazione di un'applicazione in un file singolo è richiesto .NET Core 3.0 o versioni successive. + {StrBegin="NETSDK1123: "} + + + NETSDK1124: Trimming assemblies requires .NET Core 3.0 or higher. + NETSDK1124: per il trimming degli assembly è richiesto .NET Core 3.0 o versioni successive. + {StrBegin="NETSDK1124: "} + + + NETSDK1129: The 'Publish' target is not supported without specifying a target framework. The current project targets multiple frameworks, you must specify the framework for the published application. + NETSDK1129: la destinazione 'Publish' non è supportata se non viene specificato un framework di destinazione. Il progetto corrente è destinato a più framework, di conseguenza è necessario specificare il framework per l'applicazione pubblicata. + {StrBegin="NETSDK1129: "} + + + NETSDK1096: Optimizing assemblies for performance failed. You can either exclude the failing assemblies from being optimized, or set the PublishReadyToRun property to false. + NETSDK1096: l'ottimizzazione degli assembly per le prestazioni non è riuscita. È possibile escludere gli assembly in errore dall'ottimizzazione oppure impostare la proprietà PublishReadyToRun su false. + {StrBegin="NETSDK1096: "} + + + Some ReadyToRun compilations emitted warnings, indicating potential missing dependencies. Missing dependencies could potentially cause runtime failures. To show the warnings, set the PublishReadyToRunShowWarnings property to true. + Alcune compilazioni eseguite con la proprietà ReadyToRun hanno restituito avvisi per indicare potenziali dipendenze mancanti. Le dipendenze mancanti potrebbero causare errori di runtime. Per visualizzare gli avvisi, impostare la proprietà PublishReadyToRunShowWarnings su true. + + + + NETSDK1094: Unable to optimize assemblies for performance: a valid runtime package was not found. Either set the PublishReadyToRun property to false, or use a supported runtime identifier when publishing. When targeting .NET 6 or higher, make sure to restore packages with the PublishReadyToRun property set to true. + NETSDK1094: non è possibile ottimizzare gli assembly per le prestazioni perché non è stato trovato alcun pacchetto di runtime valido. Impostare la proprietà PublishReadyToRun su false oppure usare un identificatore di runtime supportato durante la pubblicazione. Quando si usa .NET 6 o versioni successive, assicurarsi di ripristinare i pacchetti con la proprietà PublishReadyToRun impostata su true. + {StrBegin="NETSDK1094: "} + + + NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture. Please verify you are using a supported runtime identifier, or set the PublishReadyToRun property to false. + NETSDK1095: l'ottimizzazione degli assembly per le prestazioni non è supportata per la piattaforma o l'architettura di destinazione selezionata. Verificare di usare un identificatore di runtime supportato oppure impostare la proprietà PublishReadyToRun su false. + {StrBegin="NETSDK1095: "} + + + NETSDK1103: RollForward setting is only supported on .NET Core 3.0 or higher. + NETSDK1103: l'impostazione RollForward è supportata solo in .NET Core 3.0 o versione successiva. + {StrBegin="NETSDK1103: "} + + + NETSDK1083: The specified RuntimeIdentifier '{0}' is not recognized. + NETSDK1083: l'elemento RuntimeIdentifier '{0}' specificato non è riconosciuto. + {StrBegin="NETSDK1083: "} + + + NETSDK1028: Specify a RuntimeIdentifier + NETSDK1028: specificare un elemento RuntimeIdentifier + {StrBegin="NETSDK1028: "} + + + NETSDK1109: Runtime list file '{0}' was not found. Report this error to the .NET team here: https://aka.ms/dotnet-sdk-issue. + NETSDK1109: il file di elenco di runtime '{0}' non è stato trovato. Segnalare questo errore al team di .NET all'indirizzo: https://aka.ms/dotnet-sdk-issue. + {StrBegin="NETSDK1109: "} + + + NETSDK1112: The runtime pack for {0} was not downloaded. Try running a NuGet restore with the RuntimeIdentifier '{1}'. + NETSDK1112: il pacchetto di runtime per {0} non è stato scaricato. Provare a eseguire un ripristino NuGet con RuntimeIdentifier '{1}'. + {StrBegin="NETSDK1112: "} + + + NETSDK1185: The Runtime Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true. + NETSDK1185: il Runtime Pack per FrameworkReference '{0}' non è disponibile. È possibile che DisableTransitiveFrameworkReferenceDownloads sia stato impostato su true. + {StrBegin="NETSDK1185: "} + + + NETSDK1150: The referenced project '{0}' is a non self-contained executable. A non self-contained executable cannot be referenced by a self-contained executable. For more information, see https://aka.ms/netsdk1150 + NETSDK1150: il progetto '{0}' a cui viene fatto riferimento è un eseguibile non autonomo. Non è possibile fare riferimento a un eseguibile non autonomo da un eseguibile autonomo. Per altre informazioni, vedere https://aka.ms/netsdk1150 + {StrBegin="NETSDK1150: "} + + + NETSDK1179: One of '--self-contained' or '--no-self-contained' options are required when '--runtime' is used. + NETSDK1179: quando si usa '--runtime' è necessaria una delle opzioni '--self-contained' o '--no-self-contained'. + {StrBegin="NETSDK1179: "} + + + NETSDK1048: 'AdditionalProbingPaths' were specified for GenerateRuntimeConfigurationFiles, but are being skipped because 'RuntimeConfigDevPath' is empty. + NETSDK1048: per GenerateRuntimeConfigurationFiles è stato specificato 'AdditionalProbingPaths', ma questo valore verrà ignorato perché 'RuntimeConfigDevPath' è vuoto. + {StrBegin="NETSDK1048: "} + + + NETSDK1138: The target framework '{0}' is out of support and will not receive security updates in the future. Please refer to {1} for more information about the support policy. + NETSDK1138: il framework di destinazione '{0}' non è più supportato e non riceverà aggiornamenti della sicurezza in futuro. Per altre informazioni sui criteri di supporto, vedere {1}. + {StrBegin="NETSDK1138: "} + + + NETSDK1046: The TargetFramework value '{0}' is not valid. To multi-target, use the 'TargetFrameworks' property instead. + NETSDK1046: il valore '{0}' di TargetFramework non è valido. Per impostare più destinazioni, usare la proprietà 'TargetFrameworks'. + {StrBegin="NETSDK1046: "} + + + NETSDK1145: The {0} pack is not installed and NuGet package restore is not supported. Upgrade Visual Studio, remove global.json if it specifies a certain SDK version, and uninstall the newer SDK. For more options visit https://aka.ms/targeting-apphost-pack-missing Pack Type:{0}, Pack directory: {1}, targetframework: {2}, Pack PackageId: {3}, Pack Package Version: {4} + NETSDK1145: il pacchetto {0} non è installato e il ripristino del pacchetto NuGet non è supportato. Aggiornare Visual Studio, rimuovere global.json se specifica una determinata versione dell'SDK e disinstallare l'SDK più recente. Per altre opzioni, vedere https://aka.ms/targeting-apphost-pack-missing. Tipo del pacchetto: {0}. Directory del pacchetto: {1}. Framework di destinazione: {2}. ID pacchetto: {3}. Versione del pacchetto: {4} + {StrBegin="NETSDK1145: "} + + + NETSDK1127: The targeting pack {0} is not installed. Please restore and try again. + NETSDK1127: il Targeting Pack {0} non è installato. Ripristinare e riprovare. + {StrBegin="NETSDK1127: "} + + + NETSDK1184: The Targeting Pack for FrameworkReference '{0}' was not available. This may be because DisableTransitiveFrameworkReferenceDownloads was set to true. + NETSDK1184: il Targeting Pack per FrameworkReference '{0}' non è disponibile. È possibile che DisableTransitiveFrameworkReferenceDownloads sia stato impostato su true. + {StrBegin="NETSDK1184: "} + + + NETSDK1175: Windows Forms is not supported or recommended with trimming enabled. Please go to https://aka.ms/dotnet-illink/windows-forms for more details. + NETSDK1175: quando il trimming è abilitato, Windows Form non è supportato o consigliato. Per altre informazioni, vedere https://aka.ms/dotnet-illink/windows-forms. + {StrBegin="NETSDK1175: "} + + + NETSDK1168: WPF is not supported or recommended with trimming enabled. Please go to https://aka.ms/dotnet-illink/wpf for more details. + NETSDK1168: quando il trimming è abilitato, il WPF non è supportato o consigliato. Per altre informazioni, visitare https://aka.ms/dotnet-illink/wpf. + {StrBegin="NETSDK1168: "} + + + NETSDK1172: The provided type library '{0}' does not exist. + NETSDK1172: la libreria dei tipi specificata '{0}' non esiste. + {StrBegin="NETSDK1172: "} + + + NETSDK1016: Unable to find resolved path for '{0}'. + NETSDK1016: il percorso risolto per '{0}' non è stato trovato. + {StrBegin="NETSDK1016: "} + + + Unable to use package assets cache due to I/O error. This can occur when the same project is built more than once in parallel. Performance may be degraded, but the build result will not be impacted. + Non è possibile usare la cache delle risorse del pacchetto a causa dell'errore di I/O. Questo problema può verificarsi quando lo stesso progetto viene compilato più volte in parallelo. Può influire sulle prestazioni, ma non sul risultato della compilazione. + + + + NETSDK1012: Unexpected file type for '{0}'. Type is both '{1}' and '{2}'. + NETSDK1012: tipo di file imprevisto per '{0}'. Il tipo è sia '{1}' che '{2}'. + {StrBegin="NETSDK1012: "} + + + NETSDK1073: The FrameworkReference '{0}' was not recognized + NETSDK1073: l'elemento FrameworkReference '{0}' non è stato riconosciuto + {StrBegin="NETSDK1073: "} + + + NETSDK1186: This project depends on Maui Essentials through a project or NuGet package reference, but doesn't declare that dependency explicitly. To build this project, you must set the UseMauiEssentials property to true (and install the Maui workload if necessary). + NETSDK1186: questo progetto dipende da Maui Essentials tramite un riferimento al progetto o al pacchetto NuGet, ma non dichiara questa dipendenza in modo esplicito. Per compilare questo progetto, è necessario impostare la proprietà UseMauiEssentials su true e, se necessario, installare il carico di lavoro Maui. + {StrBegin="NETSDK1186: "} + + + NETSDK1137: It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'. + NETSDK1137: non è più necessario usare Microsoft.NET.Sdk.WindowsDesktop SDK. Provare a modificare l'attributo Sdk dell'elemento Project radice in 'Microsoft.NET.Sdk'. + {StrBegin="NETSDK1137: "} + + + NETSDK1009: Unrecognized preprocessor token '{0}' in '{1}'. + NETSDK1009: token di preprocessore '{0}' non riconosciuto in '{1}'. + {StrBegin="NETSDK1009: "} + + + NETSDK1081: The targeting pack for {0} was not found. You may be able to resolve this by running a NuGet restore on the project. + NETSDK1081: il pacchetto di destinazione per {0} non è stato trovato. Per risolvere il problema, eseguire un ripristino NuGet sul progetto. + {StrBegin="NETSDK1081: "} + + + NETSDK1019: {0} is an unsupported framework. + NETSDK1019: {0} è un framework non supportato. + {StrBegin="NETSDK1019: "} + + + NETSDK1056: Project is targeting runtime '{0}' but did not resolve any runtime-specific packages. This runtime may not be supported by the target framework. + NETSDK1056: il progetto è destinato al runtime '{0}' ma non ha risolto pacchetti specifici del runtime. È possibile che questo runtime non sia supportato dal framework di destinazione. + {StrBegin="NETSDK1056: "} + + + NETSDK1050: The version of Microsoft.NET.Sdk used by this project is insufficient to support references to libraries targeting .NET Standard 1.5 or higher. Please install version 2.0 or higher of the .NET Core SDK. + NETSDK1050: la versione di Microsoft.NET.Sdk usata da questo progetto non è sufficiente per supportare i riferimenti alle librerie destinate a .NET Standard 1.5 o versione successiva. Installare la versione 2.0 o successiva di .NET Core SDK. + {StrBegin="NETSDK1050: "} + + + NETSDK1045: The current .NET SDK does not support targeting {0} {1}. Either target {0} {2} or lower, or use a version of the .NET SDK that supports {0} {1}. + NETSDK1045: la versione corrente di .NET SDK non supporta {0} {1} come destinazione. Impostare come destinazione {0} {2} o una versione precedente oppure usare una versione di .NET SDK che supporta {0} {1}. + {StrBegin="NETSDK1045: "} + + + NETSDK1139: The target platform identifier {0} was not recognized. + NETSDK1139: l'identificatore di piattaforma di destinazione {0} non è stato riconosciuto. + {StrBegin="NETSDK1139: "} + + + NETSDK1107: Microsoft.NET.Sdk.WindowsDesktop is required to build Windows desktop applications. 'UseWpf' and 'UseWindowsForms' are not supported by the current SDK. + NETSDK1107: per compilare applicazioni desktop di Windows, è necessario Microsoft.NET.Sdk.WindowsDesktop. 'UseWpf' e 'UseWindowsForms' non sono supportati dall'SDK corrente. + {StrBegin="NETSDK1107: "} + + + NETSDK1057: You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy + NETSDK1057: si sta usando una versione in anteprima di .NET. Vedere https://aka.ms/dotnet-support-policy + + + + NETSDK1131: Producing a managed Windows Metadata component with WinMDExp is not supported when targeting {0}. + NETSDK1131: la produzione di un componente Metadati Windows gestito con WinMDExp non è supportata quando la destinazione è {0}. + {StrBegin="NETSDK1131: "} + + + NETSDK1130: {1} cannot be referenced. Referencing a Windows Metadata component directly when targeting .NET 5 or higher is not supported. For more information, see https://aka.ms/netsdk1130 + NETSDK1130: non è possibile fare riferimento a {1}. Il riferimento diretto a un componente di Metadati Windows quando la destinazione è .NET 5 o versione successiva non è supportato. Per altre informazioni, vedere https://aka.ms/netsdk1130 + {StrBegin="NETSDK1130: "} + + + NETSDK1149: {0} cannot be referenced because it uses built-in support for WinRT, which is no longer supported in .NET 5 and higher. An updated version of the component supporting .NET 5 is needed. For more information, see https://aka.ms/netsdk1149 + NETSDK1149: non è possibile fare riferimento a {0} perché usa il supporto incorporato per WinRT, che non è più supportato in .NET 5 e versioni successive. È necessaria una versione aggiornata del componente che supporta .NET 5. Per altre informazioni, vedere https://aka.ms/netsdk1149 + {StrBegin="NETSDK1149: "} + + + NETSDK1106: Microsoft.NET.Sdk.WindowsDesktop requires 'UseWpf' or 'UseWindowsForms' to be set to 'true' + NETSDK1106: con Microsoft.NET.Sdk.WindowsDesktop 'UseWpf' o 'UseWindowsForms' deve essere impostato su 'true' + {StrBegin="NETSDK1106: "} + + + NETSDK1105: Windows desktop applications are only supported on .NET Core 3.0 or higher. + NETSDK1105: le applicazioni desktop di Windows sono supportate solo in .NET Core 3.0 o versioni successive. + {StrBegin="NETSDK1105: "} + + + NETSDK1100: To build a project targeting Windows on this operating system, set the EnableWindowsTargeting property to true. + NETSDK1100: per compilare un progetto destinato a Windows in questo sistema operativo, impostare la proprietà EnableWindowsTargeting su true. + {StrBegin="NETSDK1100: "} + + + NETSDK1136: The target platform must be set to Windows (usually by including '-windows' in the TargetFramework property) when using Windows Forms or WPF, or referencing projects or packages that do so. + NETSDK1136: la piattaforma di destinazione deve essere impostata su Windows, in genere includendo '-windows ' nella proprietà TargetFramework, quando si usa Windows Forms o WPF oppure si fa riferimento a progetti o pacchetti che lo usano. + {StrBegin="NETSDK1136: "} + + + NETSDK1148: A referenced assembly was compiled using a newer version of Microsoft.Windows.SDK.NET.dll. Please update to a newer .NET SDK in order to reference this assembly. + NETSDK1148: un assembly di riferimento è stato compilato con una versione più recente di Microsoft.Windows.SDK.NET.dll. Eseguire l'aggiornamento a un SDK .NET più recente per fare riferimento a questo assembly. + {StrBegin="NETSDK1148: "} + + + NETSDK1178: The project depends on the following workload packs that do not exist in any of the workloads available in this installation: {0} +You may need to build the project on another operating system or architecture, or update the .NET SDK. + NETSDK1178: il progetto dipende dai pacchetti di carico di lavoro seguenti che non esistono in nessuno dei carichi di lavoro disponibili in questa installazione: {0} +Potrebbe essere necessario compilare il progetto in un altro sistema operativo o architettura oppure aggiornare .NET SDK. + {StrBegin="NETSDK1178: "} + + + NETSDK1147: To build this project, the following workloads must be installed: {0} +To install these workloads, run the following command: dotnet workload restore + NETSDK1147: per compilare questo progetto devono essere installati i seguenti carichi di lavoro: {0} +Per installare questi carichi di lavoro, eseguire il seguente comando: dotnet workload restore + {StrBegin="NETSDK1147: "} LOCALIZATION: Do not localize "dotnet workload restore" + + + + \ No newline at end of file diff --git a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf index b2e92f72528f..fb2243add46d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ja.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ja.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf index 9c4324313549..6bea40a6b102 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ko.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ko.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf index 5ab487a42688..ca025c6489a9 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pl.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pl.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf index 71409117b491..43cc0bf00d1d 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.pt-BR.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf index ed15554f78ba..ec09cb4862a7 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.ru.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.ru.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf index 18f3ef251f72..3dfe2d4f0310 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.tr.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.tr.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf index b97f5e6a8cc3..9e287b92ae02 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hans.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf index 71edc797ae70..261577be88af 100644 --- a/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf +++ b/src/Tasks/Common/Resources/xlf/Strings.zh-Hant.xlf @@ -721,8 +721,8 @@ The following are names of parameters or literal values and should not be transl {StrBegin="NETSDK1122: "} - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. - NETSDK1193: PublishSelfContained must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. + NETSDK1193: If PublishSelfContained is set, it must be either true or false. The value given was '{0}'. {StrBegin="NETSDK1193: "} diff --git a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs index d9bfe1b371e5..82fbfd804c79 100644 --- a/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs +++ b/src/Tests/Microsoft.NET.Build.Tests/GivenThatWeWantToBuildASelfContainedApp.cs @@ -99,21 +99,21 @@ public void It_errors_out_when_RuntimeIdentifier_architecture_and_PlatformTarget const string PlatformTarget = "x86"; var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld") - .WithSource() - .WithProjectChanges(project => - { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", RuntimeIdentifier)); + .CopyTestAsset("HelloWorld") + .WithSource() + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", RuntimeIdentifier)); propertyGroup.Add(new XElement(ns + "PlatformTarget", PlatformTarget)); - }); + }); - var buildCommand = new BuildCommand(testAsset); + var buildCommand = new BuildCommand(testAsset); - buildCommand - .Execute() - .Should() + buildCommand + .Execute() + .Should() .Fail() .And.HaveStdOutContaining(string.Format( Strings.CannotHaveRuntimeIdentifierPlatformMismatchPlatformTarget, @@ -121,41 +121,41 @@ public void It_errors_out_when_RuntimeIdentifier_architecture_and_PlatformTarget PlatformTarget)); } - [Fact] - public void It_succeeds_when_RuntimeIdentifier_and_PlatformTarget_mismatch_but_PT_is_AnyCPU() - { - var targetFramework = ToolsetInfo.CurrentTargetFramework; - var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); - var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld") - .WithSource() - .WithProjectChanges(project => - { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); - propertyGroup.Add(new XElement(ns + "PlatformTarget", "AnyCPU")); - }); - - var buildCommand = new BuildCommand(testAsset); - - buildCommand - .Execute() - .Should() - .Pass(); - - var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); - var selfContainedExecutable = $"HelloWorld{Constants.ExeSuffix}"; - - string selfContainedExecutableFullPath = Path.Combine(outputDirectory.FullName, selfContainedExecutable); + [Fact] + public void It_succeeds_when_RuntimeIdentifier_and_PlatformTarget_mismatch_but_PT_is_AnyCPU() + { + var targetFramework = ToolsetInfo.CurrentTargetFramework; + var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); + var testAsset = _testAssetsManager + .CopyTestAsset("HelloWorld") + .WithSource() + .WithProjectChanges(project => + { + var ns = project.Root.Name.Namespace; + var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); + propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); + propertyGroup.Add(new XElement(ns + "PlatformTarget", "AnyCPU")); + }); + + var buildCommand = new BuildCommand(testAsset); + + buildCommand + .Execute() + .Should() + .Pass(); + + var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); + var selfContainedExecutable = $"HelloWorld{Constants.ExeSuffix}"; + + string selfContainedExecutableFullPath = Path.Combine(outputDirectory.FullName, selfContainedExecutable); new RunExeCommand(Log, selfContainedExecutableFullPath) - .Execute() - .Should() - .Pass() - .And - .HaveStdOutContaining("Hello World!"); - } + .Execute() + .Should() + .Pass() + .And + .HaveStdOutContaining("Hello World!"); + } [RequiresMSBuildVersionFact("17.0.0.32901")] public void It_resolves_runtimepack_from_packs_folder() @@ -317,7 +317,7 @@ static int Last2DigitsTo0(int versionBuild) "); // Verify correct targeting pack version is resolved - var getValuesCommand = (GetValuesCommand) new GetValuesCommand(testAsset, "TargetingPack", GetValuesCommand.ValueType.Item) + var getValuesCommand = (GetValuesCommand)new GetValuesCommand(testAsset, "TargetingPack", GetValuesCommand.ValueType.Item) .WithEnvironmentVariable(EnvironmentVariableNames.WORKLOAD_MANIFEST_ROOTS, manifestRoot); getValuesCommand.MetadataNames = new List() { "NuGetPackageId", "NuGetPackageVersion" }; getValuesCommand.DependsOnTargets = "ProcessFrameworkReferences"; @@ -351,19 +351,22 @@ static int Last2DigitsTo0(int versionBuild) [Theory] [InlineData("net6.0")] - public void It_can_publish_runtime_specific_apps_with_library_dependencies_self_contained(string targetFramework) { + public void It_can_publish_runtime_specific_apps_with_library_dependencies_self_contained(string targetFramework) + { // create a basic library and a basic app, reference the library from the app and then // publish the app with a RID specified and self-contained. // verify that no warnings about missing the --self-contained flag are emitted. var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); - var libProject = new TestProject("RidSelfContainedLib"){ + var libProject = new TestProject("RidSelfContainedLib") + { IsExe = false, TargetFrameworks = targetFramework, IsSdkProject = true }; var createdLibProject = _testAssetsManager.CreateTestProject(libProject); - var appProject = new TestProject("RidSelfContainedApp") { + var appProject = new TestProject("RidSelfContainedApp") + { IsExe = true, TargetFrameworks = targetFramework, IsSdkProject = true @@ -371,14 +374,14 @@ public void It_can_publish_runtime_specific_apps_with_library_dependencies_self_ appProject.ReferencedProjects.Add(libProject); var createdAppProject = _testAssetsManager.CreateTestProject(appProject); var publishCommand = new PublishCommand(createdAppProject); - publishCommand.Execute(new [] {"-property:SelfContained=true", "-property:_CommandLineDefinedSelfContained=true", $"-property:RuntimeIdentifier={rid}", "-property:_CommandLineDefinedRuntimeIdentifier=true" }).Should().Pass().And.NotHaveStdOutContaining("warning"); + publishCommand.Execute(new[] { "-property:SelfContained=true", "-property:_CommandLineDefinedSelfContained=true", $"-property:RuntimeIdentifier={rid}", "-property:_CommandLineDefinedRuntimeIdentifier=true" }).Should().Pass().And.NotHaveStdOutContaining("warning"); } - [Theory] - [InlineData("net7.0")] - public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_true(string targetFramework) + [Fact] + public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_true() { - var runtimeIdentifier = EnvironmentInfo.GetCompatibleRid(targetFramework); + string targetFramework = ToolsetInfo.CurrentTargetFramework; + var testAsset = _testAssetsManager .CopyTestAsset("HelloWorld", identifier: "ItDoesNotBuildSCDueToPSC") .WithSource() @@ -387,8 +390,6 @@ public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_tr { var ns = project.Root.Name.Namespace; var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "RuntimeIdentifier", runtimeIdentifier)); - propertyGroup.Add(new XElement(ns + "SelfContained", "false")); propertyGroup.Add(new XElement(ns + "PublishSelfContained", "true")); }); @@ -399,7 +400,7 @@ public void It_does_not_build_SelfContained_due_to_PublishSelfContained_being_tr .Should() .Pass(); - var outputDirectory = buildCommand.GetOutputDirectory(targetFramework, runtimeIdentifier: runtimeIdentifier); + var outputDirectory = buildCommand.GetOutputDirectory(targetFramework); outputDirectory.Should().NotHaveFile("hostfxr.dll"); // This file will only appear if SelfContained. } diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs index 57298deb5cce..7b04755fe0eb 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs @@ -3,6 +3,7 @@ using System.ComponentModel; using System.IO; +using System.Linq; using Xunit.Abstractions; namespace Microsoft.NET.TestFramework.Commands @@ -11,6 +12,11 @@ public sealed class PublishCommand : MSBuildCommand { private const string PublishSubfolderName = "publish"; + private DirectoryInfo GetPublishDirectory(DirectoryInfo baseDirectory) + { + return new DirectoryInfo(Path.Combine(baseDirectory.FullName, PublishSubfolderName)); + } + // Encourage use of the other overload, which is generally simpler to use [EditorBrowsable(EditorBrowsableState.Never)] public PublishCommand(ITestOutputHelper log, string projectPath) @@ -26,8 +32,8 @@ public PublishCommand(TestAsset testAsset, string relativePathToProject = null) public override DirectoryInfo GetOutputDirectory(string targetFramework = "netcoreapp1.1", string configuration = "Debug", string runtimeIdentifier = "") { - DirectoryInfo baseDirectory = base.GetOutputDirectory(targetFramework, configuration, runtimeIdentifier); - return new DirectoryInfo(Path.Combine(baseDirectory.FullName, PublishSubfolderName)); + DirectoryInfo baseDirectory = base.GetOutputDirectory(targetFramework, configuration, runtimeIdentifier); + return GetPublishDirectory(baseDirectory); } public string GetPublishedAppPath(string appName, string targetFramework = "netcoreapp1.1") diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs index 9df9d44a4f25..940fd6c653e0 100644 --- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs +++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs @@ -51,7 +51,7 @@ public TestProject([CallerMemberName] string name = null) public List PackageReferences { get; } = new List(); public List DotNetCliToolReferences { get; } = new List(); - + public List CopyFilesTargets { get; } = new List(); public Dictionary SourceFiles { get; } = new Dictionary(); @@ -60,7 +60,7 @@ public TestProject([CallerMemberName] string name = null) public Dictionary AdditionalProperties { get; } = new Dictionary(); - public List>> AdditionalItems { get; } = new (); + public List>> AdditionalItems { get; } = new(); public List> ProjectChanges { get; } = new List>(); @@ -299,7 +299,7 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder, new XAttribute("Include", frameworkReference))); } } - + if (this.CopyFilesTargets.Any()) { foreach (var copyFilesTarget in CopyFilesTargets) @@ -443,7 +443,7 @@ public class {safeThisName}Class public void AddItem(string itemName, string attributeName, string attributeValue) { - AddItem(itemName, new Dictionary() { { attributeName, attributeValue } } ); + AddItem(itemName, new Dictionary() { { attributeName, attributeValue } }); } public void AddItem(string itemName, Dictionary attributes) @@ -458,15 +458,20 @@ public void RecordProperties(params string[] propertyNames) public Dictionary GetPropertyValues(string testRoot, string configuration = "Debug", string targetFramework = null, string runtimeIdentifier = null) { - var propertyValues = new Dictionary(); - - string intermediateOutputPath = Path.Combine(testRoot, Name, "obj", configuration, targetFramework ?? TargetFrameworks); + string finalOutputPath = Path.Combine(testRoot, Name, "obj", configuration, targetFramework ?? TargetFrameworks); if (!string.IsNullOrEmpty(runtimeIdentifier)) { - intermediateOutputPath = Path.Combine(intermediateOutputPath, runtimeIdentifier); + finalOutputPath = Path.Combine(finalOutputPath, runtimeIdentifier); } - foreach (var line in File.ReadAllLines(Path.Combine(intermediateOutputPath, "PropertyValues.txt"))) + return GetPropertyValues(finalOutputPath); + } + + public Dictionary GetPropertyValues(string finalOutputPath) + { + var propertyValues = new Dictionary(); + + foreach (var line in File.ReadAllLines(Path.Combine(finalOutputPath, "PropertyValues.txt"))) { int colonIndex = line.IndexOf(':'); if (colonIndex > 0) diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 88bee5bbba12..77df96d3ae78 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -13,6 +13,7 @@ using Microsoft.NET.TestFramework; using Microsoft.NET.TestFramework.Assertions; using Microsoft.NET.TestFramework.Commands; +using Microsoft.NET.TestFramework.ProjectConstruction; using Xunit; using Xunit.Abstractions; using LocalizableStrings = Microsoft.DotNet.Tools.Publish.LocalizableStrings; @@ -160,46 +161,51 @@ public void ItPublishesSelfContainedWithPublishSelfContainedTrue() } [Theory] - [InlineData("net7.0", true, false, false)] - [InlineData("net7.0", false, false, false)] - [InlineData("net7.0", true, true, false)] - [InlineData("net7.0", true, true, true)] - public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContainProperty(string targetFramework, bool publishSelfContained, bool selfContainedIsGlobal, bool publishSelfContainedIsGlobal) + [InlineData(true, false, false)] + [InlineData(false, false, false)] + [InlineData(true, true, false)] + public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContained(bool publishSelfContained, bool selfContainedIsGlobal, bool publishSelfContainedIsGlobal) { - var rid = EnvironmentInfo.GetCompatibleRid(targetFramework); + bool selfContained = !publishSelfContained; + bool resultShouldBeSelfContained = publishSelfContained && !selfContainedIsGlobal; - var testAsset = _testAssetsManager - .CopyTestAsset("HelloWorld", identifier: $"PSC-OVERRIDES-{publishSelfContained}-{selfContainedIsGlobal}-{publishSelfContainedIsGlobal}") - .WithSource() - .WithProjectChanges(project => + string targetFramework = ToolsetInfo.CurrentTargetFramework; + var testProject = new TestProject("MainProject") { - var ns = project.Root.Name.Namespace; - var propertyGroup = project.Root.Elements(ns + "PropertyGroup").First(); - propertyGroup.Add(new XElement(ns + "SelfContained", (!publishSelfContained).ToString())); - propertyGroup.Add(new XElement(ns + "PublishSelfContained", publishSelfContained.ToString())); - }); + TargetFrameworks = targetFramework, + IsExe = true + }; - var publishCommand = new PublishCommand(testAsset); + testProject.RecordProperties("SelfContained"); + if (!publishSelfContainedIsGlobal) + testProject.AdditionalProperties["PublishSelfContained"] = publishSelfContained.ToString(); + if (!selfContainedIsGlobal) + testProject.AdditionalProperties["SelfContained"] = selfContained.ToString(); + + var testAsset = _testAssetsManager.CreateTestProject(testProject, identifier: $"PSC-OVERRIDES-{publishSelfContained}-{selfContainedIsGlobal}-{publishSelfContainedIsGlobal}"); + var publishCommand = new DotnetCommand(Log); List args = new List { - $"/p:RuntimeIdentifier={rid}", - $"/p:_IsPublishing=true", // Normally this would be set by the CLI (OR VS Soon TM), but this calls directly into t:/Publish. - selfContainedIsGlobal ? $"/p:SelfContained={!publishSelfContained}" : "", - publishSelfContainedIsGlobal ? $"/p:PublishSelfContained={publishSelfContained}" : "" + "publish", + selfContainedIsGlobal ? $"/p:SelfContained={selfContained}" : "", + publishSelfContainedIsGlobal ? $"/p:PublishSelfContained={publishSelfContained}" : "", + "-bl:C:\\users\\noahgilson\\PSCWHYRID.binlog" }; publishCommand + .WithWorkingDirectory(Path.Combine(testAsset.Path, "MainProject")) .Execute(args.ToArray()) .Should() .Pass(); - var publishedDirectory = publishCommand.GetOutputDirectory(targetFramework: targetFramework, runtimeIdentifier: rid); - var expectedFiles = new[] { "HelloWorld.dll" }; - - if (publishSelfContained && !selfContainedIsGlobal) - expectedFiles.Append("System.dll"); // System.dll should only exist if self contained + var publishedDirectory = testAsset.TestRoot; + //var publishedDirectory = publishCommand.GetOutputDirectoryWithAutomaticRid(targetFramework: targetFramework, directoryShouldHaveRuntimeIdentifier: resultShouldBeSelfContained); + var properties = testProject.GetPropertyValues(publishedDirectory); - publishedDirectory.Should().HaveFiles(expectedFiles); + if (resultShouldBeSelfContained) + { + Assert.True(properties["SelfContained"] == "true"); + } } [Fact] From 244a090d7877b66141300b24d505001b320f5154 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 1 Nov 2022 13:22:03 -0700 Subject: [PATCH 17/19] Conclude work on the tests. --- .../Commands/PublishCommand.cs | 10 ++-------- .../ProjectConstruction/TestProject.cs | 8 ++++++++ .../GivenDotnetPublishPublishesProjects.cs | 14 ++++++++------ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs b/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs index 7b04755fe0eb..57298deb5cce 100644 --- a/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs +++ b/src/Tests/Microsoft.NET.TestFramework/Commands/PublishCommand.cs @@ -3,7 +3,6 @@ using System.ComponentModel; using System.IO; -using System.Linq; using Xunit.Abstractions; namespace Microsoft.NET.TestFramework.Commands @@ -12,11 +11,6 @@ public sealed class PublishCommand : MSBuildCommand { private const string PublishSubfolderName = "publish"; - private DirectoryInfo GetPublishDirectory(DirectoryInfo baseDirectory) - { - return new DirectoryInfo(Path.Combine(baseDirectory.FullName, PublishSubfolderName)); - } - // Encourage use of the other overload, which is generally simpler to use [EditorBrowsable(EditorBrowsableState.Never)] public PublishCommand(ITestOutputHelper log, string projectPath) @@ -32,8 +26,8 @@ public PublishCommand(TestAsset testAsset, string relativePathToProject = null) public override DirectoryInfo GetOutputDirectory(string targetFramework = "netcoreapp1.1", string configuration = "Debug", string runtimeIdentifier = "") { - DirectoryInfo baseDirectory = base.GetOutputDirectory(targetFramework, configuration, runtimeIdentifier); - return GetPublishDirectory(baseDirectory); + DirectoryInfo baseDirectory = base.GetOutputDirectory(targetFramework, configuration, runtimeIdentifier); + return new DirectoryInfo(Path.Combine(baseDirectory.FullName, PublishSubfolderName)); } public string GetPublishedAppPath(string appName, string targetFramework = "netcoreapp1.1") diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs index 940fd6c653e0..6665884b24e9 100644 --- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs +++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs @@ -467,6 +467,14 @@ public Dictionary GetPropertyValues(string testRoot, string conf return GetPropertyValues(finalOutputPath); } + /// + /// Returns a dictionary of property name to value mappings. + /// + /// + /// The final output path after executing a dotnet command where propertyvalues.txt will be generated. + /// If the output path does not need to be hardcoded, use the overload requesting testRoot instead. + /// + /// public Dictionary GetPropertyValues(string finalOutputPath) { var propertyValues = new Dictionary(); diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 77df96d3ae78..78a006f69a45 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -161,9 +161,9 @@ public void ItPublishesSelfContainedWithPublishSelfContainedTrue() } [Theory] - [InlineData(true, false, false)] - [InlineData(false, false, false)] - [InlineData(true, true, false)] + [InlineData(true, false, false)] // PublishSC sets SC to true even if SC is false in the project file + [InlineData(false, false, false)] // PublishSC sets SC to false even if SC is true in the project file + [InlineData(true, true, false)] // PublishSC does not take effect if SC is global public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContained(bool publishSelfContained, bool selfContainedIsGlobal, bool publishSelfContainedIsGlobal) { bool selfContained = !publishSelfContained; @@ -199,12 +199,14 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContained(bool p .Pass(); var publishedDirectory = testAsset.TestRoot; - //var publishedDirectory = publishCommand.GetOutputDirectoryWithAutomaticRid(targetFramework: targetFramework, directoryShouldHaveRuntimeIdentifier: resultShouldBeSelfContained); - var properties = testProject.GetPropertyValues(publishedDirectory); + publishedDirectory = Path.Combine(publishedDirectory, "MainProject", "obj", "Debug", targetFramework); + if (resultShouldBeSelfContained) + publishedDirectory = Directory.GetDirectories(publishedDirectory).FirstOrDefault(); // get the rid in the directory + var properties = testProject.GetPropertyValues(publishedDirectory.ToString()); if (resultShouldBeSelfContained) { - Assert.True(properties["SelfContained"] == "true"); + Assert.True(bool.Parse(properties["SelfContained"]) == true); } } From 509598d7237d646d1364102f067ffe7f0724a2e7 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Tue, 1 Nov 2022 13:42:56 -0700 Subject: [PATCH 18/19] Remove BL again --- .../dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index 78a006f69a45..aaa96422af30 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -189,7 +189,6 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContained(bool p "publish", selfContainedIsGlobal ? $"/p:SelfContained={selfContained}" : "", publishSelfContainedIsGlobal ? $"/p:PublishSelfContained={publishSelfContained}" : "", - "-bl:C:\\users\\noahgilson\\PSCWHYRID.binlog" }; publishCommand From a6e5ce0ea01959669459eaddf3619a5442d58b63 Mon Sep 17 00:00:00 2001 From: Noah Gilson Date: Wed, 2 Nov 2022 13:54:25 -0700 Subject: [PATCH 19/19] Remove psc error added in 7.0.2xx merge, and remove changes to testproject so changes from publishrid can be used instead --- ...oft.NET.RuntimeIdentifierInference.targets | 4 --- .../ProjectConstruction/TestProject.cs | 31 ++++++------------- .../GivenDotnetPublishPublishesProjects.cs | 6 +--- 3 files changed, 10 insertions(+), 31 deletions(-) diff --git a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets index dd3284c2df61..a354ca5003d3 100644 --- a/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets +++ b/src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.RuntimeIdentifierInference.targets @@ -175,10 +175,6 @@ Copyright (c) .NET Foundation. All rights reserved. ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed" FormatArguments="SelfContained"/> - - diff --git a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs index 6665884b24e9..9df9d44a4f25 100644 --- a/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs +++ b/src/Tests/Microsoft.NET.TestFramework/ProjectConstruction/TestProject.cs @@ -51,7 +51,7 @@ public TestProject([CallerMemberName] string name = null) public List PackageReferences { get; } = new List(); public List DotNetCliToolReferences { get; } = new List(); - + public List CopyFilesTargets { get; } = new List(); public Dictionary SourceFiles { get; } = new Dictionary(); @@ -60,7 +60,7 @@ public TestProject([CallerMemberName] string name = null) public Dictionary AdditionalProperties { get; } = new Dictionary(); - public List>> AdditionalItems { get; } = new(); + public List>> AdditionalItems { get; } = new (); public List> ProjectChanges { get; } = new List>(); @@ -299,7 +299,7 @@ internal void Create(TestAsset targetTestAsset, string testProjectsSourceFolder, new XAttribute("Include", frameworkReference))); } } - + if (this.CopyFilesTargets.Any()) { foreach (var copyFilesTarget in CopyFilesTargets) @@ -443,7 +443,7 @@ public class {safeThisName}Class public void AddItem(string itemName, string attributeName, string attributeValue) { - AddItem(itemName, new Dictionary() { { attributeName, attributeValue } }); + AddItem(itemName, new Dictionary() { { attributeName, attributeValue } } ); } public void AddItem(string itemName, Dictionary attributes) @@ -458,28 +458,15 @@ public void RecordProperties(params string[] propertyNames) public Dictionary GetPropertyValues(string testRoot, string configuration = "Debug", string targetFramework = null, string runtimeIdentifier = null) { - string finalOutputPath = Path.Combine(testRoot, Name, "obj", configuration, targetFramework ?? TargetFrameworks); + var propertyValues = new Dictionary(); + + string intermediateOutputPath = Path.Combine(testRoot, Name, "obj", configuration, targetFramework ?? TargetFrameworks); if (!string.IsNullOrEmpty(runtimeIdentifier)) { - finalOutputPath = Path.Combine(finalOutputPath, runtimeIdentifier); + intermediateOutputPath = Path.Combine(intermediateOutputPath, runtimeIdentifier); } - return GetPropertyValues(finalOutputPath); - } - - /// - /// Returns a dictionary of property name to value mappings. - /// - /// - /// The final output path after executing a dotnet command where propertyvalues.txt will be generated. - /// If the output path does not need to be hardcoded, use the overload requesting testRoot instead. - /// - /// - public Dictionary GetPropertyValues(string finalOutputPath) - { - var propertyValues = new Dictionary(); - - foreach (var line in File.ReadAllLines(Path.Combine(finalOutputPath, "PropertyValues.txt"))) + foreach (var line in File.ReadAllLines(Path.Combine(intermediateOutputPath, "PropertyValues.txt"))) { int colonIndex = line.IndexOf(':'); if (colonIndex > 0) diff --git a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs index aaa96422af30..71a547a81c62 100644 --- a/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs +++ b/src/Tests/dotnet-publish.Tests/GivenDotnetPublishPublishesProjects.cs @@ -197,11 +197,7 @@ public void PublishSelfContainedPropertyDoesOrDoesntOverrideSelfContained(bool p .Should() .Pass(); - var publishedDirectory = testAsset.TestRoot; - publishedDirectory = Path.Combine(publishedDirectory, "MainProject", "obj", "Debug", targetFramework); - if (resultShouldBeSelfContained) - publishedDirectory = Directory.GetDirectories(publishedDirectory).FirstOrDefault(); // get the rid in the directory - var properties = testProject.GetPropertyValues(publishedDirectory.ToString()); + var properties = testProject.GetPropertyValues(testAsset.TestRoot, targetFramework: targetFramework); if (resultShouldBeSelfContained) {