From d39a905a5bed79ca5d2c4c17bb21660f5b1db453 Mon Sep 17 00:00:00 2001 From: dasMulli Date: Tue, 3 May 2016 23:06:54 +0200 Subject: [PATCH 1/2] Updated dotnet-new templates to new project.json schema. --- .../CSharp_Console/project.json.pretemplate | 2 +- .../FSharp_Console/project.json.pretemplate | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate b/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate index 88f99d13e..8429abb78 100644 --- a/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate +++ b/src/dotnet/commands/dotnet-new/CSharp_Console/project.json.pretemplate @@ -1,6 +1,6 @@ { "version": "1.0.0-*", - "compilationOptions": { + "buildOptions": { "emitEntryPoint": true }, "dependencies": { diff --git a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate index e527b7159..792f42989 100644 --- a/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate +++ b/src/dotnet/commands/dotnet-new/FSharp_Console/project.json.pretemplate @@ -1,12 +1,14 @@ { "version": "1.0.0-*", - "compilationOptions": { - "emitEntryPoint": true + "buildOptions": { + "emitEntryPoint": true, + "compilerName": "fsc", + "compile": { + "includeFiles": [ + "Program.fs" + ] + } }, - "compilerName": "fsc", - "compileFiles": [ - "Program.fs" - ], "dependencies": { "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-160316", "Microsoft.NETCore.App": { From d2cedd318f2024656a8bf0a7e5b4c98a04c8d2aa Mon Sep 17 00:00:00 2001 From: dasMulli Date: Tue, 3 May 2016 23:07:50 +0200 Subject: [PATCH 2/2] Added a test to ensure that C# projects created by dotnet-new are built without warnings. --- .../GivenThatIWantANewCSApp.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSApp.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSApp.cs index 089e03208..e5f98313a 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewCSApp.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSApp.cs @@ -35,6 +35,24 @@ namespace Microsoft.DotNet.Tests .Should().Pass(); } + [Fact] + public void When_dotnet_build_is_invoked_Then_project_builds_without_warnings() + { + var rootPath = Temp.CreateDirectory().Path; + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("new"); + + new TestCommand("dotnet") { WorkingDirectory = rootPath } + .Execute("restore"); + + var buildResult = new TestCommand("dotnet") { WorkingDirectory = rootPath } + .ExecuteWithCapturedOutput("build"); + + buildResult.Should().Pass(); + buildResult.Should().NotHaveStdErr(); + } + private static void AddProjectJsonDependency(string projectJsonPath, string dependencyId, string dependencyVersion) { var projectJsonRoot = ReadProject(projectJsonPath);