From b4a9020c5b615e7c47a5312afaae3e8665012e30 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Fri, 3 Oct 2025 11:53:38 +0200 Subject: [PATCH 1/2] Disallow quotes in file-level directives --- .../dotnet/Commands/CliCommandStrings.resx | 3 + .../Run/VirtualProjectBuildingCommand.cs | 9 ++- .../Commands/xlf/CliCommandStrings.cs.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.de.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.es.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.fr.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.it.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.ja.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.ko.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.pl.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.pt-BR.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.ru.xlf | 5 ++ .../Commands/xlf/CliCommandStrings.tr.xlf | 5 ++ .../xlf/CliCommandStrings.zh-Hans.xlf | 5 ++ .../xlf/CliCommandStrings.zh-Hant.xlf | 5 ++ .../Convert/DotnetProjectConvertTests.cs | 60 +++++++++++++++---- 16 files changed, 123 insertions(+), 14 deletions(-) diff --git a/src/Cli/dotnet/Commands/CliCommandStrings.resx b/src/Cli/dotnet/Commands/CliCommandStrings.resx index 3a3fab487f89..9d06490b8ddd 100644 --- a/src/Cli/dotnet/Commands/CliCommandStrings.resx +++ b/src/Cli/dotnet/Commands/CliCommandStrings.resx @@ -1619,6 +1619,9 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man Duplicate directives are not supported: {0} {0} is the directive type and name. + + Directives currently cannot contain quotes ("). + Cannot specify option '{0}' when also using '-' to read the file from standard input. {0} is an option name like '--no-build'. diff --git a/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs b/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs index 8da06cc0a47f..d09c67788f6d 100644 --- a/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs +++ b/src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs @@ -1490,8 +1490,15 @@ public static ImmutableArray FindDirectives(SourceFile sourceFi Diagnostics = diagnostics, SourceFile = sourceFile, DirectiveKind = name.ToString(), - DirectiveText = value.ToString() + DirectiveText = value.ToString(), }; + + // Block quotes now so we can later support quoted values without a breaking change. https://github.com/dotnet/sdk/issues/49367 + if (value.Contains('"')) + { + diagnostics.AddError(sourceFile, context.Info.Span, CliCommandStrings.QuoteInDirective); + } + if (CSharpDirective.Parse(context) is { } directive) { // If the directive is already present, report an error. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf index 9e6ea08c74b9..5f24d81f1759 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. Ve výchozím nastavení je publikována aplikace závislá na architektuře. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Vypne buildovací server Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf index 585628e6400b..bd4c50224fb4 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. Standardmäßig wird eine Framework-abhängige Anwendung veröffentlicht. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Hiermit wird der Razor-Buildserver heruntergefahren. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf index 3860162de57e..ea7f7d5eea94 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. El valor predeterminado es publicar una aplicación dependiente del marco. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Apaga el servidor de compilación de Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf index 82c93100c2a2..96bf7cbfc408 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. La valeur par défaut est de publier une application dépendante du framework. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Arrêtez le serveur de builds Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf index d5e325548a52..335213e49b0f 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. Per impostazione predefinita, viene generato un pacchetto dipendente dal framework. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Arresta il server di compilazione di Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf index d094f986fe57..7007aa33ae49 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. 既定では、フレームワークに依存したアプリケーションが公開されます。 + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Razor ビルド サーバーをシャットダウンします。 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf index f818c10fae6d..8a3faf015b8f 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. 기본값은 프레임워크 종속 애플리케이션을 게시하는 것입니다. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Razor 빌드 서버를 종료합니다. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf index 100304d2eee0..11604f56b30f 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. Domyślnie publikowana jest aplikacja zależna od struktury. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Zamknij serwer kompilacji Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf index 2e8c726a75a1..dce34def31a0 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. O padrão é publicar uma aplicação dependente de framework. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Desligar o servidor de build do Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf index 391f4d068e0c..d88c04f0be25 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. По умолчанию публикация выполняется в приложение, зависимое от платформы. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Завершает работу сервера сборки Razor. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf index f6ffea6d2984..3d1abe061cab 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. Varsayılan durum, çerçeveye bağımlı bir uygulama yayımlamaktır. + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. Razor derleme sunucusunu kapatır. diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf index 7878f6ad146e..be3a28437dc0 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. 默认情况下发布依赖于框架的应用程序。 + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. 关闭 Razor 生成服务器。 diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf index 5cc582623c6d..82048b92c57c 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf @@ -2552,6 +2552,11 @@ The default is to publish a framework-dependent application. 預設為發佈與 Framework 相依的應用程式。 + + Directives currently cannot contain quotes ("). + Directives currently cannot contain quotes ("). + + Shut down the Razor build server. 關閉 Razor 組建伺服器。 diff --git a/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs b/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs index cb7fd4331429..40ff299fcb32 100644 --- a/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs +++ b/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Immutable; using System.Security; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis.Text; @@ -1168,10 +1169,10 @@ public void Directives_InvalidPropertyName() { VerifyConversionThrows( inputCSharp: """ - #:property Name"=Value + #:property 123Name=Value """, expectedWildcardPattern: RunFileTests.DirectiveError("/app/Program.cs", 1, CliCommandStrings.PropertyDirectiveInvalidName, """ - The '"' character, hexadecimal value 0x22, cannot be included in a name. + Name cannot begin with the '1' character, hexadecimal value 0x31. """)); } @@ -1221,7 +1222,13 @@ public void Directives_Escaping() """, - expectedCSharp: ""); + expectedCSharp: "", + expectedErrors: + [ + (1, CliCommandStrings.QuoteInDirective), + (2, CliCommandStrings.QuoteInDirective), + (3, CliCommandStrings.QuoteInDirective), + ]); } [Fact] @@ -1257,7 +1264,11 @@ public void Directives_Whitespace() # ! /test #! /program x # :property Name=Value - """); + """, + expectedErrors: + [ + (3, CliCommandStrings.QuoteInDirective), + ]); } [Fact] @@ -1548,10 +1559,15 @@ public void Directives_VersionedSdkFirst() """); } - private static void Convert(string inputCSharp, out string actualProject, out string? actualCSharp, bool force, string? filePath) + private const string programPath = "/app/Program.cs"; + + private static void Convert(string inputCSharp, out string actualProject, out string? actualCSharp, bool force, string? filePath, + bool collectDiagnostics, out ImmutableArray.Builder? actualDiagnostics) { - var sourceFile = new SourceFile(filePath ?? "/app/Program.cs", SourceText.From(inputCSharp, Encoding.UTF8)); - var directives = VirtualProjectBuildingCommand.FindDirectives(sourceFile, reportAllErrors: !force, DiagnosticBag.ThrowOnFirst()); + var sourceFile = new SourceFile(filePath ?? programPath, SourceText.From(inputCSharp, Encoding.UTF8)); + actualDiagnostics = null; + var diagnosticBag = collectDiagnostics ? DiagnosticBag.Collect(out actualDiagnostics) : DiagnosticBag.ThrowOnFirst(); + var directives = VirtualProjectBuildingCommand.FindDirectives(sourceFile, reportAllErrors: !force, diagnosticBag); var projectWriter = new StringWriter(); VirtualProjectBuildingCommand.WriteProjectFile(projectWriter, directives, isVirtualProject: false); actualProject = projectWriter.ToString(); @@ -1561,25 +1577,43 @@ private static void Convert(string inputCSharp, out string actualProject, out st /// /// means the conversion should not touch the C# content. /// - private static void VerifyConversion(string inputCSharp, string expectedProject, string? expectedCSharp, bool force = false, string? filePath = null) + private static void VerifyConversion(string inputCSharp, string expectedProject, string? expectedCSharp, bool force = false, string? filePath = null, + IEnumerable<(int LineNumber, string Message)>? expectedErrors = null) { - Convert(inputCSharp, out var actualProject, out var actualCSharp, force: force, filePath: filePath); + Convert(inputCSharp, out var actualProject, out var actualCSharp, force: force, filePath: filePath, + collectDiagnostics: expectedErrors != null, out var actualDiagnostics); actualProject.Should().Be(expectedProject); actualCSharp.Should().Be(expectedCSharp); + VerifyErrors(actualDiagnostics, expectedErrors); } private static void VerifyConversionThrows(string inputCSharp, string expectedWildcardPattern) { - var convert = () => Convert(inputCSharp, out _, out _, force: false, filePath: null); + var convert = () => Convert(inputCSharp, out _, out _, force: false, filePath: null, collectDiagnostics: false, out _); convert.Should().Throw().WithMessage(expectedWildcardPattern); } private static void VerifyDirectiveConversionErrors(string inputCSharp, IEnumerable<(int LineNumber, string Message)> expectedErrors) { - var programPath = "/app/Program.cs"; var sourceFile = new SourceFile(programPath, SourceText.From(inputCSharp, Encoding.UTF8)); VirtualProjectBuildingCommand.FindDirectives(sourceFile, reportAllErrors: true, DiagnosticBag.Collect(out var diagnostics)); - Assert.All(diagnostics, d => { Assert.Equal(programPath, d.Location.Path); }); - diagnostics.Select(d => (d.Location.Span.Start.Line + 1, d.Message)).Should().BeEquivalentTo(expectedErrors); + VerifyErrors(diagnostics, expectedErrors); + } + + private static void VerifyErrors(ImmutableArray.Builder? actual, IEnumerable<(int LineNumber, string Message)>? expected) + { + if (actual is null) + { + Assert.Null(expected); + } + else if (expected is null) + { + Assert.Null(actual); + } + else + { + Assert.All(actual, d => { Assert.Equal(programPath, d.Location.Path); }); + actual.Select(d => (d.Location.Span.Start.Line + 1, d.Message)).Should().BeEquivalentTo(expected); + } } } From c174aa6a9f5624f8f00e3ddbc30633d95dba7a74 Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Mon, 6 Oct 2025 13:07:53 +0200 Subject: [PATCH 2/2] Improve wording and tests --- .../dotnet/Commands/CliCommandStrings.resx | 4 ++-- .../Commands/xlf/CliCommandStrings.cs.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.de.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.es.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.fr.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.it.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.ja.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.ko.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.pl.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.pt-BR.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.ru.xlf | 4 ++-- .../Commands/xlf/CliCommandStrings.tr.xlf | 4 ++-- .../xlf/CliCommandStrings.zh-Hans.xlf | 4 ++-- .../xlf/CliCommandStrings.zh-Hant.xlf | 4 ++-- .../Convert/DotnetProjectConvertTests.cs | 20 ++++++++++++++----- 15 files changed, 43 insertions(+), 33 deletions(-) diff --git a/src/Cli/dotnet/Commands/CliCommandStrings.resx b/src/Cli/dotnet/Commands/CliCommandStrings.resx index 9d06490b8ddd..612d5d7e79b3 100644 --- a/src/Cli/dotnet/Commands/CliCommandStrings.resx +++ b/src/Cli/dotnet/Commands/CliCommandStrings.resx @@ -1620,7 +1620,7 @@ Tool '{1}' (version '{2}') was successfully installed. Entry is added to the man {0} is the directive type and name. - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). Cannot specify option '{0}' when also using '-' to read the file from standard input. @@ -2701,4 +2701,4 @@ Proceed? Received 'ExecutionId' of value '{0}' for message '{1}' while the 'ExecutionId' received of the handshake message was '{2}'. {Locked="ExecutionId"} - \ No newline at end of file + diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf index 5f24d81f1759..fc4b1a211af3 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.cs.xlf @@ -2553,8 +2553,8 @@ Ve výchozím nastavení je publikována aplikace závislá na architektuře. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf index bd4c50224fb4..21b27f9a681b 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.de.xlf @@ -2553,8 +2553,8 @@ Standardmäßig wird eine Framework-abhängige Anwendung veröffentlicht. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf index ea7f7d5eea94..f5a5e3bdd1e0 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.es.xlf @@ -2553,8 +2553,8 @@ El valor predeterminado es publicar una aplicación dependiente del marco. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf index 96bf7cbfc408..a3b99c5e41d1 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.fr.xlf @@ -2553,8 +2553,8 @@ La valeur par défaut est de publier une application dépendante du framework. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf index 335213e49b0f..01bb00598b1d 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.it.xlf @@ -2553,8 +2553,8 @@ Per impostazione predefinita, viene generato un pacchetto dipendente dal framewo - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf index 7007aa33ae49..9a994d5f437e 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ja.xlf @@ -2553,8 +2553,8 @@ The default is to publish a framework-dependent application. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf index 8a3faf015b8f..2871573f2a5b 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ko.xlf @@ -2553,8 +2553,8 @@ The default is to publish a framework-dependent application. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf index 11604f56b30f..53eb991a0b60 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pl.xlf @@ -2553,8 +2553,8 @@ Domyślnie publikowana jest aplikacja zależna od struktury. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf index dce34def31a0..cc6f4e0e2e0b 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.pt-BR.xlf @@ -2553,8 +2553,8 @@ O padrão é publicar uma aplicação dependente de framework. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf index d88c04f0be25..6de89911ae8a 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.ru.xlf @@ -2553,8 +2553,8 @@ The default is to publish a framework-dependent application. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf index 3d1abe061cab..c921cd558b98 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.tr.xlf @@ -2553,8 +2553,8 @@ Varsayılan durum, çerçeveye bağımlı bir uygulama yayımlamaktır. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf index be3a28437dc0..7921c750e057 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hans.xlf @@ -2553,8 +2553,8 @@ The default is to publish a framework-dependent application. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf index 82048b92c57c..406398fbc9c8 100644 --- a/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/Commands/xlf/CliCommandStrings.zh-Hant.xlf @@ -2553,8 +2553,8 @@ The default is to publish a framework-dependent application. - Directives currently cannot contain quotes ("). - Directives currently cannot contain quotes ("). + Directives currently cannot contain double quotes ("). + Directives currently cannot contain double quotes ("). diff --git a/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs b/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs index 40ff299fcb32..90763462aeb4 100644 --- a/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs +++ b/test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs @@ -1199,11 +1199,14 @@ public void Directives_Escaping() VerifyConversion( inputCSharp: """ #:property Prop= - #:sdk @="<>test - #:package @="<>test + #:sdk @="<>te'st + #:package @="<>te'st + #:property Pro'p=Single' + #:property Prop2=\"Value\" + #:property Prop3='Value' """, expectedProject: $""" - + Exe @@ -1213,21 +1216,28 @@ public void Directives_Escaping() true true <test"> + \"Value\" + 'Value' - + """, - expectedCSharp: "", + expectedCSharp: """ + #:property Pro'p=Single' + + """, expectedErrors: [ (1, CliCommandStrings.QuoteInDirective), (2, CliCommandStrings.QuoteInDirective), (3, CliCommandStrings.QuoteInDirective), + (4, string.Format(CliCommandStrings.PropertyDirectiveInvalidName, "The ''' character, hexadecimal value 0x27, cannot be included in a name.")), + (5, CliCommandStrings.QuoteInDirective), ]); }