From d1b1a65f0b3364ab031dcf6230d0f528b7afc97b Mon Sep 17 00:00:00 2001 From: Andy Gocke Date: Fri, 3 Apr 2015 14:38:23 -0700 Subject: [PATCH] Fix the names of the resources in the MSBuild task. Some of the build task names where still set to their old values from when they were in MSBuild. This changes the names to the proper names and also ports any missing resources to the resource files in the current build task assembly. --- src/Compilers/Core/MSBuildTask/Csc.cs | 10 +-- .../Core/MSBuildTask/ErrorString.Designer.cs | 90 +++++++++++++++++++ .../Core/MSBuildTask/ErrorString.resx | 38 ++++++++ .../Core/MSBuildTask/ManagedCompiler.cs | 12 +-- src/Compilers/Core/MSBuildTask/Vbc.cs | 10 +-- 5 files changed, 144 insertions(+), 16 deletions(-) diff --git a/src/Compilers/Core/MSBuildTask/Csc.cs b/src/Compilers/Core/MSBuildTask/Csc.cs index 5f78b3ea546..03e0112354f 100644 --- a/src/Compilers/Core/MSBuildTask/Csc.cs +++ b/src/Compilers/Core/MSBuildTask/Csc.cs @@ -196,7 +196,7 @@ override protected string GenerateFullPathToTool() if (null == pathToTool) { - Log.LogErrorWithCodeFromResources("General.FrameworksFileNotFound", ToolName, ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion.VersionLatest)); + Log.LogErrorWithCodeFromResources("General_FrameworksFileNotFound", ToolName, ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion.VersionLatest)); } } @@ -424,7 +424,7 @@ internal string GetDefineConstantsSwitch(string originalDefineConstants) } else if (singleIdentifier.Length > 0) { - Log.LogWarningWithCodeFromResources("Csc.InvalidParameterWarning", "/define:", singleIdentifier); + Log.LogWarningWithCodeFromResources("Csc_InvalidParameterWarning", "/define:", singleIdentifier); } } @@ -496,7 +496,7 @@ ICscHostObject cscHostObject // shelling out to the command-line compiler anyway. That means the command-line // compiler will log the error. So here, we only log the error if we would've // tried to use the host compiler. - Log.LogErrorWithCodeFromResources("General.CouldNotSetHostObjectParameter", param, e.Message); + Log.LogErrorWithCodeFromResources("General_CouldNotSetHostObjectParameter", param, e.Message); } return false; } @@ -628,7 +628,7 @@ ICscHostObject cscHostObject // shelling out to the command-line compiler anyway. That means the command-line // compiler will log the error. So here, we only log the error if we would've // tried to use the host compiler. - Log.LogErrorWithCodeFromResources("General.CouldNotSetHostObjectParameter", param, e.Message); + Log.LogErrorWithCodeFromResources("General_CouldNotSetHostObjectParameter", param, e.Message); } return false; } @@ -726,7 +726,7 @@ override protected HostObjectInitializationStatus InitializeHostObject() } else { - Log.LogErrorWithCodeFromResources("General.IncorrectHostObject", "Csc", "ICscHostObject"); + Log.LogErrorWithCodeFromResources("General_IncorrectHostObject", "Csc", "ICscHostObject"); } } } diff --git a/src/Compilers/Core/MSBuildTask/ErrorString.Designer.cs b/src/Compilers/Core/MSBuildTask/ErrorString.Designer.cs index de485bf2667..7ec131b657a 100644 --- a/src/Compilers/Core/MSBuildTask/ErrorString.Designer.cs +++ b/src/Compilers/Core/MSBuildTask/ErrorString.Designer.cs @@ -60,6 +60,15 @@ internal class ErrorString { } } + /// + /// Looks up a localized string similar to MSB3883: Unexpected exception: . + /// + internal static string Compiler_UnexpectedException { + get { + return ResourceManager.GetString("Compiler_UnexpectedException", resourceCulture); + } + } + /// /// Looks up a localized string similar to MSB3053: The assembly alias "{1}" on reference "{0}" contains illegal characters.. /// @@ -96,6 +105,60 @@ internal class ErrorString { } } + /// + /// Looks up a localized string similar to MSB3081: A problem occurred while trying to set the "{0}" parameter for the IDE's in-process compiler. {1}. + /// + internal static string General_CouldNotSetHostObjectParameter { + get { + return ResourceManager.GetString("General_CouldNotSetHostObjectParameter", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSB3105: The item "{0}" was specified more than once in the "{1}" parameter. Duplicate items are not supported by the "{1}" parameter.. + /// + internal static string General_DuplicateItemsNotSupported { + get { + return ResourceManager.GetString("General_DuplicateItemsNotSupported", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSB3083: The item "{0}" was specified more than once in the "{1}" parameter and both items had the same value "{2}" for the "{3}" metadata. Duplicate items are not supported by the "{1}" parameter unless they have different values for the "{3}" metadata.. + /// + internal static string General_DuplicateItemsNotSupportedWithMetadata { + get { + return ResourceManager.GetString("General_DuplicateItemsNotSupportedWithMetadata", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Expected file "{0}" does not exist.. + /// + internal static string General_ExpectedFileMissing { + get { + return ResourceManager.GetString("General_ExpectedFileMissing", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSB3082: Task failed because "{0}" was not found, or the .NET Framework {1} is not installed. Please install the .NET Framework {1}.. + /// + internal static string General_FrameworksFileNotFound { + get { + return ResourceManager.GetString("General_FrameworksFileNotFound", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSB3087: An incompatible host object was passed into the "{0}" task. The host object for this task must implement the "{1}" interface.. + /// + internal static string General_IncorrectHostObject { + get { + return ResourceManager.GetString("General_IncorrectHostObject", resourceCulture); + } + } + /// /// Looks up a localized string similar to Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}".. /// @@ -105,6 +168,33 @@ internal class ErrorString { } } + /// + /// Looks up a localized string similar to The IDE's in-process compiler does not support the specified values for the "{0}" parameter. Therefore, this task will fallback to using the command-line compiler.. + /// + internal static string General_ParameterUnsupportedOnHostCompiler { + get { + return ResourceManager.GetString("General_ParameterUnsupportedOnHostCompiler", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSB3104: The referenced assembly "{0}" was not found. If this assembly is produced by another one of your projects, please make sure to build that project before building this one.. + /// + internal static string General_ReferenceDoesNotExist { + get { + return ResourceManager.GetString("General_ReferenceDoesNotExist", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to MSB3401: "{1}" is an invalid value for the "{0}" parameter. The valid values are: {2}. + /// + internal static string Vbc_EnumParameterHasInvalidValue { + get { + return ResourceManager.GetString("Vbc_EnumParameterHasInvalidValue", resourceCulture); + } + } + /// /// Looks up a localized string similar to "{1}" is an invalid value for the "{0}" parameter.. /// diff --git a/src/Compilers/Core/MSBuildTask/ErrorString.resx b/src/Compilers/Core/MSBuildTask/ErrorString.resx index 84f1cc4aa53..8241086d873 100644 --- a/src/Compilers/Core/MSBuildTask/ErrorString.resx +++ b/src/Compilers/Core/MSBuildTask/ErrorString.resx @@ -117,6 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + MSB3883: Unexpected exception: + {StrBegin="MSB3883: "} + MSB3053: The assembly alias "{1}" on reference "{0}" contains illegal characters. {StrBegin="MSB3053: "} @@ -132,9 +136,43 @@ The string "{0}" cannot be converted to a boolean (true/false) value. + + MSB3081: A problem occurred while trying to set the "{0}" parameter for the IDE's in-process compiler. {1} + {StrBegin="MSB3081: "} + + + MSB3105: The item "{0}" was specified more than once in the "{1}" parameter. Duplicate items are not supported by the "{1}" parameter. + {StrBegin="MSB3105: "} + + + MSB3083: The item "{0}" was specified more than once in the "{1}" parameter and both items had the same value "{2}" for the "{3}" metadata. Duplicate items are not supported by the "{1}" parameter unless they have different values for the "{3}" metadata. + {StrBegin="MSB3083: "} + + + Expected file "{0}" does not exist. + + + MSB3082: Task failed because "{0}" was not found, or the .NET Framework {1} is not installed. Please install the .NET Framework {1}. + {StrBegin="MSB3082: "} + + + MSB3087: An incompatible host object was passed into the "{0}" task. The host object for this task must implement the "{1}" interface. + {StrBegin="MSB3087: "} + Item "{0}" has attribute "{1}" with value "{2}" that could not be converted to "{3}". + + The IDE's in-process compiler does not support the specified values for the "{0}" parameter. Therefore, this task will fallback to using the command-line compiler. + + + MSB3104: The referenced assembly "{0}" was not found. If this assembly is produced by another one of your projects, please make sure to build that project before building this one. + {StrBegin="MSB3104: "} + + + MSB3401: "{1}" is an invalid value for the "{0}" parameter. The valid values are: {2} + {StrBegin="MSB3401: "} + "{1}" is an invalid value for the "{0}" parameter. diff --git a/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs b/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs index 683c82ec946..8cf49e1cf98 100644 --- a/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs +++ b/src/Compilers/Core/MSBuildTask/ManagedCompiler.cs @@ -334,7 +334,7 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand } catch (Exception e) { - Log.LogErrorWithCodeFromResources("Compiler.UnexpectedException"); + Log.LogErrorWithCodeFromResources("Compiler_UnexpectedException"); LogErrorOutput(e.ToString()); ExitCode = -1; } @@ -722,11 +722,11 @@ private bool ListHasNoDuplicateItems(ITaskItem[] itemList, string parameterName, { if (disambiguatingMetadataName == null || String.IsNullOrEmpty(disambiguatingMetadataValue)) { - Log.LogErrorWithCodeFromResources("General.DuplicateItemsNotSupported", item.ItemSpec, parameterName); + Log.LogErrorWithCodeFromResources("General_DuplicateItemsNotSupported", item.ItemSpec, parameterName); } else { - Log.LogErrorWithCodeFromResources("General.DuplicateItemsNotSupportedWithMetadata", item.ItemSpec, parameterName, disambiguatingMetadataValue, disambiguatingMetadataName); + Log.LogErrorWithCodeFromResources("General_DuplicateItemsNotSupportedWithMetadata", item.ItemSpec, parameterName, disambiguatingMetadataValue, disambiguatingMetadataName); } return false; } @@ -805,7 +805,7 @@ bool resultFromHostObjectSetOperation { if (!resultFromHostObjectSetOperation) { - Log.LogMessageFromResources(MessageImportance.Normal, "General.ParameterUnsupportedOnHostCompiler", parameterName); + Log.LogMessageFromResources(MessageImportance.Normal, "General_ParameterUnsupportedOnHostCompiler", parameterName); _hostCompilerSupportsAllParameters = false; } } @@ -829,7 +829,7 @@ protected bool CheckAllReferencesExistOnDisk() if (!File.Exists(reference.ItemSpec)) { success = false; - Log.LogErrorWithCodeFromResources("General.ReferenceDoesNotExist", reference.ItemSpec); + Log.LogErrorWithCodeFromResources("General_ReferenceDoesNotExist", reference.ItemSpec); } } @@ -881,7 +881,7 @@ string win32Manifest // So just a message is fine. Log.LogMessageFromResources ( - "General.ExpectedFileMissing", + "General_ExpectedFileMissing", "default.win32manifest" ); } diff --git a/src/Compilers/Core/MSBuildTask/Vbc.cs b/src/Compilers/Core/MSBuildTask/Vbc.cs index 7f76fb93429..8aa0c57168e 100644 --- a/src/Compilers/Core/MSBuildTask/Vbc.cs +++ b/src/Compilers/Core/MSBuildTask/Vbc.cs @@ -327,7 +327,7 @@ internal void MovePdbFileIfNecessary(string outputAssembly) } catch (Exception e) when (Utilities.IsIoRelatedException(e)) { - Log.LogErrorWithCodeFromResources("VBC.RenamePDB", PdbFile, e.Message); + Log.LogErrorWithCodeFromResources("VBC_RenamePDB", PdbFile, e.Message); } } @@ -344,7 +344,7 @@ override protected string GenerateFullPathToTool() if (null == pathToTool) { - Log.LogErrorWithCodeFromResources("General.FrameworksFileNotFound", ToolName, ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion.VersionLatest)); + Log.LogErrorWithCodeFromResources("General_FrameworksFileNotFound", ToolName, ToolLocationHelper.GetDotNetFrameworkVersionFolderPrefix(TargetDotNetFrameworkVersion.VersionLatest)); } } @@ -610,7 +610,7 @@ override protected bool ValidateParameters() (0 != String.Compare(Verbosity, "quiet", StringComparison.OrdinalIgnoreCase)) && (0 != String.Compare(Verbosity, "verbose", StringComparison.OrdinalIgnoreCase))) { - Log.LogErrorWithCodeFromResources("Vbc.EnumParameterHasInvalidValue", "Verbosity", this.Verbosity, "Quiet, Normal, Verbose"); + Log.LogErrorWithCodeFromResources("Vbc_EnumParameterHasInvalidValue", "Verbosity", this.Verbosity, "Quiet, Normal, Verbose"); return false; } } @@ -974,7 +974,7 @@ IVbcHostObject vbcHostObject // shelling out to the command-line compiler anyway. That means the command-line // compiler will log the error. So here, we only log the error if we would've // tried to use the host compiler. - Log.LogErrorWithCodeFromResources("General.CouldNotSetHostObjectParameter", param, e.Message); + Log.LogErrorWithCodeFromResources("General_CouldNotSetHostObjectParameter", param, e.Message); } return false; @@ -1056,7 +1056,7 @@ override protected HostObjectInitializationStatus InitializeHostObject() } else { - Log.LogErrorWithCodeFromResources("General.IncorrectHostObject", "Vbc", "IVbcHostObject"); + Log.LogErrorWithCodeFromResources("General_IncorrectHostObject", "Vbc", "IVbcHostObject"); } } } -- GitLab