Skip to content

Installing NLog.Config and NLog.Schema in a .NET Core project in Visual Studio 15.7.x and/or NuGet 4.7.x does not copy the files in the project root #2823

@kappa7194

Description

@kappa7194

Update: The issue seems to be tied to the version of Visual Studio and/or NuGet too, see below.

How to reproduce the problem

Add the NLog, NLog.Config and NLog.Schema packages to a .NET Core 2.1 Console Application project.

Expected behaviour

The XML and XSD files from NLog.Config and NLog.Schema are copied in the project root.

Actual behaviour

The files are not copied to the project root, instead they are somehow "virtually linked" there (there's no "link" at file system level) from the NuGet packages cache directories.

Why this is a problem

  1. The content of the files are shared between all projects using the packages: if I modify the XML in project A, project B will see the same changes since the physical file is the same.
  2. If the XML and the XSD are not besides each other, IntelliSense will not pick up the schema and won't provide any autocompletion.

The first problem is especially nasty since it affects every projects that is using the packages, and there's absolutely no warning about it.

Related issues

#2461, #2686, #2757

Maybe related to https://docs.microsoft.com/en-us/nuget/reference/migrate-packages-config-to-package-reference#package-compatibility-issues as suggested in #2757.

Platforms

  • Visual Studio: Microsoft Visual Studio Professional 2017 Version 15.7.5
  • ReSharper: JetBrains ReSharper Ultimate 2018.1.3 Build 112.0.20180626.160528
  • Framework: .NET Core 2.1
  • Target framework: netcoreapp2.1
  • Project type: Console application
  • Project SDK: Microsoft.NET.Sdk

Packages versions

  • NLog: 4.5.7
  • NLog.Config: 4.5.7
  • NLog.Schema: 4.5.7

Screenshots

Installing the packages adds "virtual files":

image

The files are "linked" from the NuGet packages cache:

image

The packages have been added through PackageReference:

image

The files are not copied in the project root:

image

IntelliSense will not pick up the XSD schema, and the XML file is shared between every project:

image

(The XML file in the screenshot has not been yet modified in this project, yet its content is not the default one but the modified one from another project.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report / Bug fixexternalOutside NLog (we can't fix that probably unfortunately!)nlog-configuration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions