diff --git a/configureWorkspace/configure_dotnetcore.ts b/configureWorkspace/configure_dotnetcore.ts index 9f0fa557eb..dde9c12153 100644 --- a/configureWorkspace/configure_dotnetcore.ts +++ b/configureWorkspace/configure_dotnetcore.ts @@ -226,8 +226,10 @@ function genDockerFile(serviceNameAndRelativePath: string, platform: Platform, o .replace(/\$assembly_name\$/g, assemblyNameNoExtension) .replace(/\$copy_project_commands\$/g, copyProjectCommands); - // Remove multiple empty lines, as might be produced if there's no EXPOSE statement - contents = contents.replace(new RegExp(`${nodeOs.EOL}\{3\}`, 'g'), `${nodeOs.EOL}${nodeOs.EOL}`); + // Remove multiple empty lines with single empty lines, as might be produced + // if $expose_statements$ or another template variable is an empty string + contents = contents.replace(/(\r\n){3}/g, "\r\n\r\n") + .replace(/(\n){3}/g, "\n\n"); let unreplacedToken = extractRegExGroups(contents, /(\$[a-z_]+\$)/, ['']); if (unreplacedToken[0]) { diff --git a/test/configure.test.ts b/test/configure.test.ts index 3f9ab977a3..7ba9d28033 100644 --- a/test/configure.test.ts +++ b/test/configure.test.ts @@ -1070,7 +1070,7 @@ suite("Configure (Add Docker files to Workspace)", function (this: Suite): void // Ruby suite("Ruby", () => { - testInEmptyFolder("Ruby", async () => { + testInEmptyFolder("Ruby, empty folder", async () => { await testConfigureDocker( 'Ruby', {