From 53841f90f9c9bd7146457cc767e67bb38c2c23f0 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Tue, 16 Jul 2019 00:24:38 -0700 Subject: [PATCH] Make some tweaks to the default content globs (dotnet/aspnetcore-tooling#820) * Make some tweaks to the default content globs - Don't publish/copy launchSettings.json - Make sure static content and configuration work with single file turned on - Added test \n\nCommit migrated from https://github.com/dotnet/aspnetcore-tooling/commit/63e8681fffcad8d577438af39af008068d2e7c37 --- ...Sdk.Razor.StaticAssets.ProjectSystem.props | 7 ++--- .../Sdk.Razor.CurrentVersion.props | 4 +-- .../PublishIntegrationTest.cs | 8 +++++- .../SimpleMvc/Properties/launchSettings.json | 27 +++++++++++++++++++ .../SimpleMvc/appsettings.Development.json | 9 +++++++ .../testassets/SimpleMvc/appsettings.json | 10 +++++++ 6 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 src/Razor/test/testassets/SimpleMvc/Properties/launchSettings.json create mode 100644 src/Razor/test/testassets/SimpleMvc/appsettings.Development.json create mode 100644 src/Razor/test/testassets/SimpleMvc/appsettings.json diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/Sdk/Sdk.Razor.StaticAssets.ProjectSystem.props b/src/Razor/Microsoft.NET.Sdk.Razor/src/Sdk/Sdk.Razor.StaticAssets.ProjectSystem.props index 4197d7dd74..f468e9caa7 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/Sdk/Sdk.Razor.StaticAssets.ProjectSystem.props +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/Sdk/Sdk.Razor.StaticAssets.ProjectSystem.props @@ -23,13 +23,14 @@ Copyright (c) .NET Foundation. All rights reserved. $(DefaultItemExcludes);**\jspm_packages\**;jspm_packages\** $(DefaultItemExcludes);**\bower_components\**;bower_components\** $(DefaultWebContentItemExcludes);wwwroot\** + $(DefaultWebContentItemExcludes);**\launchSettings.json - - - + + + diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props index ca4dc883af..b7d17b206b 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props +++ b/src/Razor/Microsoft.NET.Sdk.Razor/src/build/netstandard2.0/Sdk.Razor.CurrentVersion.props @@ -74,8 +74,8 @@ Copyright (c) .NET Foundation. All rights reserved. - - + + diff --git a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs index ef50fffce3..b33a6b0c71 100644 --- a/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs +++ b/src/Razor/Microsoft.NET.Sdk.Razor/test/IntegrationTests/PublishIntegrationTest.cs @@ -39,7 +39,7 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests [Fact] [InitializeTestProject("SimpleMvc")] - public async Task Publish_PublishesAssembly() + public async Task Publish_PublishesAssemblyAndContent() { var result = await DotnetMSBuild("Publish"); @@ -49,11 +49,17 @@ namespace Microsoft.AspNetCore.Razor.Design.IntegrationTests Assert.FileExists(result, OutputPath, "SimpleMvc.pdb"); Assert.FileExists(result, OutputPath, "SimpleMvc.Views.dll"); Assert.FileExists(result, OutputPath, "SimpleMvc.Views.pdb"); + Assert.FileExists(result, OutputPath, "appsettings.json"); + Assert.FileExists(result, OutputPath, "appsettings.Development.json"); + Assert.FileDoesNotExist(result, OutputPath, Path.Combine("Properties", "launchSettings.json")); Assert.FileExists(result, PublishOutputPath, "SimpleMvc.dll"); Assert.FileExists(result, PublishOutputPath, "SimpleMvc.pdb"); Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.dll"); Assert.FileExists(result, PublishOutputPath, "SimpleMvc.Views.pdb"); + Assert.FileExists(result, PublishOutputPath, "appsettings.json"); + Assert.FileExists(result, PublishOutputPath, "appsettings.Development.json"); + Assert.FileDoesNotExist(result, PublishOutputPath, Path.Combine("Properties", "launchSettings.json")); // By default refs and .cshtml files will not be copied on publish Assert.FileCountEquals(result, 0, Path.Combine(PublishOutputPath, "refs"), "*.dll"); diff --git a/src/Razor/test/testassets/SimpleMvc/Properties/launchSettings.json b/src/Razor/test/testassets/SimpleMvc/Properties/launchSettings.json new file mode 100644 index 0000000000..386e239170 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:55451", + "sslPort": 44333 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "SimpleMvc": { + "commandName": "Project", + "launchBrowser": true, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} diff --git a/src/Razor/test/testassets/SimpleMvc/appsettings.Development.json b/src/Razor/test/testassets/SimpleMvc/appsettings.Development.json new file mode 100644 index 0000000000..e203e9407e --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/src/Razor/test/testassets/SimpleMvc/appsettings.json b/src/Razor/test/testassets/SimpleMvc/appsettings.json new file mode 100644 index 0000000000..d9d9a9bff6 --- /dev/null +++ b/src/Razor/test/testassets/SimpleMvc/appsettings.json @@ -0,0 +1,10 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft": "Warning", + "Microsoft.Hosting.Lifetime": "Information" + } + }, + "AllowedHosts": "*" +}