Mat*_*tze 1 c# nlog visual-studio-2017
我一直将其内容NLog.config移至我的网站App.config,并打算删除原始的nlog配置文件。
但是Visual Studio 2017 Enterprise (15.8.4),由于以下错误消息,我无法这样做:
无法修改源自导入文件的评估对象。C:...... csproj.nuget.g.props
打开上述文件时,我发现以下部分:
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<None Include="$(NuGetPackageRoot)nlog.config\4.5.10\contentFiles\any\any\NLog.config" Condition="Exists('$(NuGetPackageRoot)nlog.config\4.5.10\contentFiles\any\any\NLog.config')">
<NuGetPackageId>NLog.Config</NuGetPackageId>
<NuGetPackageVersion>4.5.10</NuGetPackageVersion>
<NuGetItemType>None</NuGetItemType>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<TargetPath>NLog.config</TargetPath>
<Private>True</Private>
<Link>NLog.config</Link>
</None>
Run Code Online (Sandbox Code Playgroud)
删除后段<ItemGroup>的NLog.config走了,但自动生成默认的内容又上来了。
长话短说:NLog.config将所有配置内容移至项目后,如何删除项目根目录下的文件App.config
看起来像一个NuGet的东西。您可能必须删除该软件包,然后找到一个没有安装配置文件而是仅安装DLL的软件包。
每个@matze
删除用NLog替换软件包NLog.Config就可以了