Skip to content

Commit 1a49a27

Browse files
Use correct docker base image for csproj projects. Fixesaspnet#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
functionisTextFile(filename: string): boolean{
33-
returntextFileExtensions.indexOf(path.extname(filename).toLowerCase())>=0;
33+
returntextFileExtensions.indexOf(path.extname(filename).toLowerCase())>=0
34+
||textFileExtensions.indexOf(path.basename(filename))>=0;
3435
}
3536

3637
functionwriteFileEnsuringDirExists(root: string,filename: string,contents: string|Buffer){
@@ -92,6 +93,9 @@ function buildYeomanNpmPackage(outputRoot: string){
9293
{from: /.*\.csproj$/,to: 'tokenreplace-namePascalCase.csproj'}
9394
];
9495
constcontentReplacements=[
96+
// Dockerfile items
97+
{from: /FROMmicrosoft\/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
constsdkChoices=[{
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
classMyGeneratorextendsyeoman.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+
constchosenSdk=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)