gpt4 book ai didi

c# - 尝试删除 NLog.config 结果为 "Cannot modify an evaluated object originating in an imported file"

转载 作者:太空宇宙 更新时间:2023-11-03 19:41:38 24 4
gpt4 key购买 nike

我一直在搬运NLog.config的内容到我的App.config并准备删除原来的nlog配置文件。

但是Visual Studio 2017 Enterprise (15.8.4)阻止我这样做并显示以下错误消息:

Cannot modify an evaluated object originating in an imported file. 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>

删除<ItemGroup>部分后NLog.config不见了,但又出现了自动生成的默认内容。

长话短说:如何删除文件 NLog.config当我将所有配置内容移动到 App.config 时,在我项目的根目录下

最佳答案

看起来像 NuGet 的东西。您可能必须删除该软件包并找到一个不设置配置文件而只安装 DLL 的软件包。

根据@matze

删除用 NLog 替换包 NLog.Config 就成功了

关于c# - 尝试删除 NLog.config 结果为 "Cannot modify an evaluated object originating in an imported file",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52517062/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com