Add option to encode UTF-8 BOM for MsBuild RSP file generation

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: Medium
    • 9.6.6, 10.0.1
    • Affects Version/s: 6.10.4
    • Component/s: Tasks
    • None
    • 2
    • Severity 3 - Minor

      Microsoft compilers and build tools expect some input files, such as the RSP file, to be encoded as UTF-8 with a Byte Order Mark (BOM). Currently, Bamboo generates RSP files for the MsBuild task encoded as UTF-8 without a BOM.

      When the RSP file contains characters outside the basic ASCII set, such as those with diacritical marks (e.g., á, ã, ç, é, ñ, ü) and others from various Latin scripts, it is crucial to encode the file with a UTF-8 BOM to ensure accurate representation. Therefore, add a configuration option in the task UI to allow users to generate RSP files with UTF-8 BOM encoding for enhanced portability.

      A failure message may appear in the logs such as:

      simple	24-Aug-2024 01:26:49	Build MsBuild - MsBuild - Default Job #10 (MSBLD-MSBLD-JOB1-10) started building on agent 'W2022.ad.osalva.net' (Remote agent on host W2022.ad.osalva.net)
      simple	24-Aug-2024 01:26:49	Starting task 'Build' of type 'com.atlassian.bamboo.plugin.dotnet:msbuild'
      command	24-Aug-2024 01:26:49	Beginning to execute external process for build 'MsBuild - MsBuild - Default Job #10 (MSBLD-MSBLD-JOB1-10)'\n ... running command line: \nC:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe @C:\Users\vagrant\AppData\Local\Temp\MSBLD-MSBLD-JOB1-10-MsBuildTaskType-6121235792295381340.rsp\n ... in: C:\Users\vagrant\bamboo-agent-home\xml-data\build-dir\MSBLD-MSBLD-JOB1\n
      simple	24-Aug-2024 01:26:49	Outputting build debug information
      simple	24-Aug-2024 01:26:49	Displaying command line elements
      simple	24-Aug-2024 01:26:49	C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe @C:\Users\vagrant\AppData\Local\Temp\MSBLD-MSBLD-JOB1-10-MsBuildTaskType-6121235792295381340.rsp
      simple	24-Aug-2024 01:26:49	End of build debug information
      build	24-Aug-2024 01:26:49	Microsoft (R) Build Engine version 4.8.4161.0
      build	24-Aug-2024 01:26:49	[Microsoft .NET Framework, version 4.0.30319.42000]
      build	24-Aug-2024 01:26:49	Copyright (C) Microsoft Corporation. All rights reserved.
      build	24-Aug-2024 01:26:49	
      build	24-Aug-2024 01:26:49	MSBUILD : error MSB1009: Project file does not exist.    <<<<<<<<<< ERROR HERE
      build	24-Aug-2024 01:26:49	Switch: Simplesolution\SoluAA�oSimples.sln               <<<<<<<<<< ERROR HERE
      simple	24-Aug-2024 01:26:49	Failing task since return code of [C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe @C:\Users\vagrant\AppData\Local\Temp\MSBLD-MSBLD-JOB1-10-MsBuildTaskType-6121235792295381340.rsp] was 1 while expected 0
      

      Workaround

      Use a Script task instead of the MsBuild task. The script should:

      1. Create the RSP file with the correct encoding, and then
      2. Call MSBuild, passing the resulting file as an argument.

      Note: Ensure the correct code page is set for the shell in the script with the command:

      chcp 65001
      

      before creating the RSP file.

            Assignee:
            Eduardo Alvarenga (Inactive)
            Reporter:
            Andrei
            Votes:
            4 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: