如何让Visual Studio将nlog.config复制到Application.exe.nlog?

huangapple go评论52阅读模式
英文:

How can I have Visual Studio copy nlog.config to Application.exe.nlog?

问题

我正在使用Visual Studio Community 2022版本17.4.0 Preview 2.1。如果我将nlog.config的构建操作设置为Content,它会将一个名为nlog.config的文件复制到输出目录。但如果我将文件重命名为MyApp.exe.nlog,它就不会复制到输出目录,而NLog.Schema也无法正常工作。

如何让Visual Studio将nlog.config复制到Application.exe.nlog到输出目录?在NLog 5中,这是查找配置文件的第一个位置。

英文:

I'm using Visual Studio Community 2022 Version 17.4.0 Preview 2.1. If I use the build action Content for nlog.config, it copies a file named nlog.config to the output. If I rename the file to MyApp.exe.nlog, it doesn't copy it to the output and NLog.Schema doesn't work.

How can I cause visual studio to copy nlog.config to Application.exe.nlog to the output? In NLog 5, this is the first place a config file is looked for.

答案1

得分: 1

我不知道发生了什么变化,但创建 application.exe.nlog,使用生成操作 Content 和复制(如果较新),在项目构建时会导致该文件被复制到输出目录。

英文:

I don't know what changed, but creating application.exe.nlog, using build action Content and copy if newer, results in the file being copied to the output, when the project is built.

huangapple
  • 本文由 发表于 2023年3月1日 14:13:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/75600143.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定