繁体   English   中英

防止 Visual Studio 复制引用的 dll

[英]Prevent Visual Studio from duplicating referenced dll

我正在为我的应用程序(C#、WPF)开发插件系统。 我的项目结构是这样的:

Solution 'App'
    Plugins (solution folder)
        Plugin1 project (dll)
        Plugin2 project (dll)
    MainApp project (WPF)
    PluginInterface project (dll)

我编辑了项目的属性,以这种方式将它们构建在自定义文件夹中

Build
    Debug
        MainApp.exe
        PluginInterface.dll
        Plugins (folder)
            Plugin1.dll
            Plugin2.dll

由于插件应该实现Iplugin接口(在 PluginInterface 项目中),我将 PluginInterface 项目添加到每个插件项目的引用中。 但是,这会导致 Visual Studio 在 Plugins 文件夹中构建 PluginInterface.dll 的副本,而 PluginInterface 项目的 output 路径只是设置为 Build\Debug。

我还尝试在 Build\Debug(不是项目)中引用 PluginInterface.dll 文件,但结果是相同的(我没有忘记在构建之前删除所有创建的文件)。

我应该如何防止 Visual Studio 复制 PluginInterface.dll 文件?

之后您始终可以使用 msbuild 任务删除该文件;

https://docs.microsoft.com/en-us/visualstudio/msbuild/delete-task?view=vs-2019

或者使用构建后脚本;

del $(ProjectDir)\plugins\pluginInterface.dll

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM