Skip to content

3.0 SDK copies Properties/launchSettings.json to output directory #14799

@dasMulli

Description

@dasMulli

When a project referencing the Razor SDK (directly or through web/* SDKs), and contains a Properties\launchSettings.json file, it will be copied to the build output but not the publish output.

The SDK explicitly forbids copying assets in $(AppDesignerFolder) to the publish directory.

In the 3.0 wave, the behaviour of dotnet build was changed to be more like dotnet publish. The web SDKs should follow the same philosophy and not copy development assets needlessly to avoid users copying them to production (which could contain env vars with connection strings or similar).

To Reproduce

Steps to reproduce the behavior:

  1. Use .NET Core SDK 3.0.100
  2. dotnet new razor
  3. dotnet build -c Release
  4. See that the output contains bin\Release\netcoreapp3.0\Properties\launchSettings.json

Expected behavior

Assets in Properties folder not copied to the build output (Behaviour before 3.0.* SDKs).

Additional context

The Razor SDK contains

    <!-- Set CopyToPublishDirectory to Never for items under AppDesignerFolder ("Properties", by default) to avoid publishing launchSettings.json -->
    <Content Update="$(AppDesignerFolder)\**" CopyToPublishDirectory="Never" Condition="'$(AppDesignerFolder)' != ''"/>

in Sdk.Razor.StaticAssets.ProjectSystem.props but I cannot find this file on GitHub..

Adding CopyToOutputDirectory="Never" would address this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    affected-very-fewThis issue impacts very few customersarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesbugThis issue describes a behavior which is not expected - a bug.feature-razor-sdkseverity-nice-to-haveThis label is used by an internal tool

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions