Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 1a49a27

Browse files
Use correct docker base image for csproj projects. Fixes #574.
1 parent f8714e9 commit 1a49a27

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

templates/package-builder/src/build/build.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ const templates: { [key: string]: { dir: string, dotNetNewId: string, displayNam
3030
};
3131

3232
function isTextFile(filename: string): boolean {
33-
return textFileExtensions.indexOf(path.extname(filename).toLowerCase()) >= 0;
33+
return textFileExtensions.indexOf(path.extname(filename).toLowerCase()) >= 0
34+
|| textFileExtensions.indexOf(path.basename(filename)) >= 0;
3435
}
3536

3637
function writeFileEnsuringDirExists(root: string, filename: string, contents: string | Buffer) {
@@ -92,6 +93,9 @@ function buildYeomanNpmPackage(outputRoot: string) {
9293
{ from: /.*\.csproj$/, to: 'tokenreplace-namePascalCase.csproj' }
9394
];
9495
const contentReplacements = [
96+
// Dockerfile items
97+
{ from: /FROM microsoft\/dotnet:1.1.0-sdk-projectjson/g, to: 'FROM <%= dockerBaseImage %>' },
98+
9599
// .xproj items
96100
{ from: /\bWebApplicationBasic\b/g, to: '<%= namePascalCase %>' },
97101
{ from: /<ProjectGuid>[0-9a-f\-]{36}<\/ProjectGuid>/g, to: '<ProjectGuid><%= projectGuid %></ProjectGuid>' },

templates/package-builder/src/yeoman/app/index.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,13 @@ const templates = [
5050
const sdkChoices = [{
5151
value: '1.0.0-preview2-1-003177', // Current released version
5252
name: 'project.json' + chalk.gray(' (compatible with .NET Core tooling preview 2 and Visual Studio 2015)'),
53-
includeFiles: [/^project.json$/, /\.xproj$/, /_placeholder.txt$/, /\.deployment$/]
53+
includeFiles: [/^project.json$/, /\.xproj$/, /_placeholder.txt$/, /\.deployment$/],
54+
dockerBaseImage: 'microsoft/dotnet:1.1.0-sdk-projectjson'
5455
}, {
5556
value: '1.0.0-preview3-004056', // Version that ships with VS2017RC
5657
name: '.csproj' + chalk.gray(' (compatible with .NET Core tooling preview 3 and Visual Studio 2017)'),
57-
includeFiles: [/\.csproj$/]
58+
includeFiles: [/\.csproj$/],
59+
dockerBaseImage: 'microsoft/dotnet:1.1.0-sdk-msbuild'
5860
}];
5961

6062
class MyGenerator extends yeoman.Base {
@@ -110,6 +112,10 @@ class MyGenerator extends yeoman.Base {
110112
this._answers.sdkVersion = firstAnswers.sdkVersion;
111113
this._answers.namePascalCase = toPascalCase(answers.name);
112114
this._answers.projectGuid = this.options['projectguid'] || uuid.v4();
115+
116+
const chosenSdk = sdkChoices.filter(sdk => sdk.value === this._answers.sdkVersion)[0];
117+
this._answers.dockerBaseImage = chosenSdk.dockerBaseImage;
118+
113119
done();
114120
});
115121
});

templates/package-builder/src/yeoman/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-aspnetcore-spa",
3-
"version": "0.7.3",
3+
"version": "0.7.4",
44
"description": "Single-Page App templates for ASP.NET Core",
55
"author": "Microsoft",
66
"license": "Apache-2.0",

0 commit comments

Comments
 (0)