diff --git a/src/Cli/dotnet/Commands/CliCommandStrings.resx b/src/Cli/dotnet/Commands/CliCommandStrings.resx index 72c27eb3c8f6..43696999a99c 100644 --- a/src/Cli/dotnet/Commands/CliCommandStrings.resx +++ b/src/Cli/dotnet/Commands/CliCommandStrings.resx @@ -1601,7 +1601,11 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - {0} is the file path and line number. + {0} is the file path and line number.{Locked="#:property"} + + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} The directive at '{2}' should contain a name without special characters and an optional value separated by '{1}' like '#:{0} Name{1}Value'. @@ -2641,4 +2645,4 @@ Proceed? VERSION - \ No newline at end of file + diff --git a/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs b/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs index eb853ec0f2f8..e5645743a263 100644 --- a/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs +++ b/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs @@ -943,6 +943,7 @@ public static void WriteProjectFile( writer.WriteLine(""" false true + false """); } @@ -1480,7 +1481,7 @@ public sealed class Property(in ParseInfo info) : Named(info) if (propertyValue is null) { - return context.Diagnostics.AddError(context.SourceFile, context.Info.Span, location => string.Format(CliCommandStrings.PropertyDirectiveMissingParts, location)); + return context.Diagnostics.AddError(context.SourceFile, context.Info.Span, static location => string.Format(CliCommandStrings.PropertyDirectiveMissingParts, location)); } try @@ -1492,6 +1493,12 @@ public sealed class Property(in ParseInfo info) : Named(info) return context.Diagnostics.AddError(context.SourceFile, context.Info.Span, location => string.Format(CliCommandStrings.PropertyDirectiveInvalidName, location, ex.Message), ex); } + if (propertyName.Equals("RestoreUseStaticGraphEvaluation", StringComparison.OrdinalIgnoreCase) && + MSBuildUtilities.ConvertStringToBool(propertyValue)) + { + context.Diagnostics.AddError(context.SourceFile, context.Info.Span, static location => string.Format(CliCommandStrings.StaticGraphRestoreNotSupported, location)); + } + return new Property(context.Info) { Name = propertyName, diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf index 3c1b0e85fdd5..df26e2e507ce 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf @@ -2443,8 +2443,8 @@ Nástroj {1} (verze {2}) se úspěšně nainstaloval. Do souboru manifestu {3} s The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - Direktiva property musí mít dvě části oddělené znakem =, například #:property PropertyName=PropertyValue: {0} - {0} is the file path and line number. + Direktiva property musí mít dvě části oddělené znakem =, například #:property PropertyName=PropertyValue: {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Cílem projektu je více architektur. Pomocí parametru {0} určete, která arch Standardní výstup + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Stav diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf index 2062814f7e55..baf4eef5b9e7 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf @@ -2443,8 +2443,8 @@ Das Tool "{1}" (Version {2}) wurde erfolgreich installiert. Der Eintrag wird der The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - Die Eigenschaftsdirektive muss zwei durch "=" getrennte Teile aufweisen, z. B. "#:property PropertyName=PropertyValue": {0} - {0} is the file path and line number. + Die Eigenschaftsdirektive muss zwei durch "=" getrennte Teile aufweisen, z. B. "#:property PropertyName=PropertyValue": {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Ihr Projekt verwendet mehrere Zielframeworks. Geben Sie über "{0}" an, welches Standardausgabe + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Status diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf index 5a7e64a57f8b..f5b6113d39a2 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf @@ -2443,8 +2443,8 @@ La herramienta "{1}" (versión "{2}") se instaló correctamente. Se ha agregado The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - La directiva de propiedad debe tener dos partes separadas por "=", como "like '#:property PropertyName=PropertyValue": {0} - {0} is the file path and line number. + La directiva de propiedad debe tener dos partes separadas por "=", como "like '#:property PropertyName=PropertyValue": {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Su proyecto tiene como destino varias plataformas. Especifique la que quiere usa Salida estándar + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Estado diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf index f1b8e03ee92d..788222aab44e 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf @@ -2443,8 +2443,8 @@ L'outil '{1}' (version '{2}') a été correctement installé. L'entrée est ajou The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - La directive de propriété doit avoir deux parties séparées par '=' comme '#:property PropertyName=PropertyValue' : {0} - {0} is the file path and line number. + La directive de propriété doit avoir deux parties séparées par '=' comme '#:property PropertyName=PropertyValue' : {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Votre projet cible plusieurs frameworks. Spécifiez le framework à exécuter à Sortie standard + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status État diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf index 1ae5be25bf78..59aea0d5f527 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf @@ -2443,8 +2443,8 @@ Lo strumento '{1}' versione '{2}' è stato installato. La voce è stata aggiunta The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - La direttiva di proprietà deve avere due parti separate da '=', come '#:property PropertyName=PropertyValue': {0} - {0} is the file path and line number. + La direttiva di proprietà deve avere due parti separate da '=', come '#:property PropertyName=PropertyValue': {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Il progetto è destinato a più framework. Specificare il framework da eseguire Output standard + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Stato diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf index f4fca2c0570b..c26950472e7a 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf @@ -2443,8 +2443,8 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - プロパティ ディレクティブには、'#:p droperty PropertyName=PropertyValue' のように '=' で区切られた 2 つの部分が必要です: {0} - {0} is the file path and line number. + プロパティ ディレクティブには、'#:p droperty PropertyName=PropertyValue' のように '=' で区切られた 2 つの部分が必要です: {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Your project targets multiple frameworks. Specify which framework to run using ' 標準出力 + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status 状態 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf index 39fbb4fe3f57..6140a98337d7 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf @@ -2443,8 +2443,8 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - property 지시문에는 '#:property PropertyName=PropertyValue'와 같이 '='로 구분된 두 부분이 있어야 합니다. {0}. - {0} is the file path and line number. + property 지시문에는 '#:property PropertyName=PropertyValue'와 같이 '='로 구분된 두 부분이 있어야 합니다. {0}. + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Your project targets multiple frameworks. Specify which framework to run using ' 표준 출력 + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status 상태 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf index 9e5b1a9e03e3..ccc67b8fdb5f 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf @@ -2443,8 +2443,8 @@ Narzędzie „{1}” (wersja „{2}”) zostało pomyślnie zainstalowane. Wpis The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - Dyrektywa właściwości musi mieć dwie części oddzielone znakiem „=”, na przykład „'#:property PropertyName=PropertyValue”: {0} - {0} is the file path and line number. + Dyrektywa właściwości musi mieć dwie części oddzielone znakiem „=”, na przykład „'#:property PropertyName=PropertyValue”: {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Projekt ma wiele platform docelowych. Określ platformę do uruchomienia przy u Standardowe dane wyjściowe + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Stan diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf index 7b8374c3b106..b3f9b5e44a68 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf @@ -2443,8 +2443,8 @@ A ferramenta '{1}' (versão '{2}') foi instalada com êxito. A entrada foi adici The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - A diretiva de propriedade precisa ter duas partes separadas por "=", como "#:p roperty PropertyName=PropertyValue": {0} - {0} is the file path and line number. + A diretiva de propriedade precisa ter duas partes separadas por "=", como "#:p roperty PropertyName=PropertyValue": {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Ele tem diversas estruturas como destino. Especifique que estrutura executar usa Saída padrão + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Status diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf index ccd10bc59311..7afd61d2fb82 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf @@ -2443,8 +2443,8 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - Директива свойства должна иметь две части, разделенные символом "=", например "#:property PropertyName=PropertyValue": {0} - {0} is the file path and line number. + Директива свойства должна иметь две части, разделенные символом "=", например "#:property PropertyName=PropertyValue": {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Your project targets multiple frameworks. Specify which framework to run using ' Стандартный вывод + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Состояние diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf index 84aa1c8ae474..bdf48a63883b 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf @@ -2443,8 +2443,8 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - Özellik yönergesi '#:property PropertyName=PropertyValue' gibi '=' ile ayrılmış iki parçaya sahip olmalıdır: {0} - {0} is the file path and line number. + Özellik yönergesi '#:property PropertyName=PropertyValue' gibi '=' ile ayrılmış iki parçaya sahip olmalıdır: {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Projeniz birden fazla Framework'ü hedefliyor. '{0}' kullanarak hangi Framework' Standart çıkış + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status Durum diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf index 4ff9e62badfc..9aa320a46227 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf @@ -2443,8 +2443,8 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - 属性指令需要包含两个由 ‘=’ 分隔的部件,例如 '#:property PropertyName=PropertyValue': {0} - {0} is the file path and line number. + 属性指令需要包含两个由 ‘=’ 分隔的部件,例如 '#:property PropertyName=PropertyValue': {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Your project targets multiple frameworks. Specify which framework to run using ' 标准输出 + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status 状态 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf index 259fabc8e64b..50ed5f8ab9a0 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf @@ -2443,8 +2443,8 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man The property directive needs to have two parts separated by '=' like '#:property PropertyName=PropertyValue': {0} - 屬性指示詞必須有兩個部分,其以 '=' 分隔,例如 '#:property PropertyName=PropertyValue': {0} - {0} is the file path and line number. + 屬性指示詞必須有兩個部分,其以 '=' 分隔,例如 '#:property PropertyName=PropertyValue': {0} + {0} is the file path and line number.{Locked="#:property"} Publisher for the .NET Platform @@ -2982,6 +2982,11 @@ Your project targets multiple frameworks. Specify which framework to run using ' 標準輸出 + + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + Static graph restore is not supported for file-based apps. Remove the '#:property' at {0}. + {0} is the file path and line number.{Locked="#:property"} + Status 狀態 diff --git a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs index 9757e2245c95..6d06823bcdf1 100644 --- a/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs +++ b/test/dotnet.Tests/CommandTests/Run/RunFileTests.cs @@ -1287,6 +1287,51 @@ public void NoRestore_02() .And.HaveStdOut("Hello from Program"); } + [Fact] + public void Restore_StaticGraph_Implicit() + { + var testInstance = _testAssetsManager.CreateTestDirectory(); + File.WriteAllText(Path.Join(testInstance.Path, "Directory.Build.props"), """ + + + true + + + """); + var programFile = Path.Join(testInstance.Path, "Program.cs"); + File.WriteAllText(programFile, "Console.WriteLine();"); + + // Remove artifacts from possible previous runs of this test. + var artifactsDir = VirtualProjectBuildingCommand.GetArtifactsPath(programFile); + if (Directory.Exists(artifactsDir)) Directory.Delete(artifactsDir, recursive: true); + + new DotnetCommand(Log, "restore", "Program.cs") + .WithWorkingDirectory(testInstance.Path) + .Execute() + .Should().Pass(); + } + + [Fact] + public void Restore_StaticGraph_Explicit() + { + var testInstance = _testAssetsManager.CreateTestDirectory(); + var programFile = Path.Join(testInstance.Path, "Program.cs"); + File.WriteAllText(programFile, """ + #:property RestoreUseStaticGraphEvaluation=true + Console.WriteLine(); + """); + + // Remove artifacts from possible previous runs of this test. + var artifactsDir = VirtualProjectBuildingCommand.GetArtifactsPath(programFile); + if (Directory.Exists(artifactsDir)) Directory.Delete(artifactsDir, recursive: true); + + new DotnetCommand(Log, "restore", "Program.cs") + .WithWorkingDirectory(testInstance.Path) + .Execute() + .Should().Fail() + .And.HaveStdErr(string.Format(CliCommandStrings.StaticGraphRestoreNotSupported, $"{programFile}:1")); + } + [Fact] public void NoBuild_01() { @@ -2856,6 +2901,7 @@ public void Api() true false true + false net11.0 preview $(Features);FileBasedProgram @@ -2925,6 +2971,7 @@ public void Api_Diagnostic_01() true false true + false $(Features);FileBasedProgram @@ -2991,6 +3038,7 @@ public void Api_Diagnostic_02() true false true + false $(Features);FileBasedProgram