Visual Studio-如何在发布模式下删除引用 [英] Visual Studio - How to remove a reference in Release mode
问题描述
我正在开发一个供其他应用程序使用的库,感谢NLog,该库具有许多调试和日志记录语句.
I'm developing a library for use in other apps and this library has lots of debugging and logging statements thanks to NLog.
当我切换到发布模式时,是否可以排除对NLog.dll的引用?
Is it possible to exclude the reference to NLog.dll when I switch to release mode?
干杯
推荐答案
您可以手动编辑csproj文件,并执行以下操作:
You can manually edit the csproj file, and do something like this:
<Reference Include="NLog" Condition="'$(Configuration)' == 'Debug'" />
这仅使它在Debug中引用该程序集.但是,我不建议您经常这样做,因为当您更改配置时,此行为不会反映在Visual Studio的引用列表中.编译时确实有效
This only makes it reference that assembly in Debug. I wouldn't recommend doing this often though, because this behavior isn't reflected in the references list in Visual Studio when you change the configuration. It does work when compiling though
这篇关于Visual Studio-如何在发布模式下删除引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!