【问题标题】:Add cs library to visual studio globally将cs库全局添加到visual studio
【发布时间】:2023-03-20 09:50:02
【问题描述】:

我必须构建一个使用 Microsoft.Enterprice 库的解决方案。我安装了库but VS still can't find the library。我无法对解决方案进行更改(它非常大)。可以为 VS 全局添加库吗? Т提前致谢。

【问题讨论】:

  • “VS 仍然找不到库”是什么意思。你能描述一下你所看到的吗?您是否收到编译错误?您是否在解决方案资源管理器中看到错误图标?请具体。
  • 我收到了大约 150 条类似这样的消息 AccumMessageBox\Implementation\ErrorMessage.cs(1,17): error CS0234: The type or namespace name 'Practices' does not exist in the namespace 'Microsoft' (您是否缺少程序集参考?) [D:\correct\tick\src\gui\xxx\xxx\xxx.csproj] 我使用命令行 make 命令构建我的解决方案。我安装了库,将库的路径添加到环境变量%PATH%,但问题仍然存在。

标签: c# visual-studio dll


【解决方案1】:

根据 Microsoft doc Enterprise Library 6 – April 2013,您可以尝试在 nuget-package 中搜索“enterpriselibrary”。

例如,您可以选择EnterpriseLibrary.Data 并安装它。

然后,你可以像下面这样使用它:

using Microsoft.Practices.EnterpriseLibrary.Data;

 static void Main(string[] args)
        {
            ConnectionString connstr = new ConnectionString("","","");            

        }

你可以从here找到对应的类库。

评论更新: 如果要为 Visual Studio 全局安装 dll。您可以参考链接How to: Install an assembly into the global assembly cache。然后,您可以将 GAC 的程序集用于每个项目,而无需在 nuget-package 中使用它。

【讨论】:

  • 据我所知,我只能为单个项目或解决方案安装 nuget 包。正确的?或者有没有办法为 Visual Studio 全局安装它们?
  • @Arthur Tsaturyan,如果你想为 Visual Studio 全局安装 dll。您可以参考链接How to: Install an assembly into the global assembly cache。然后,您可以将 GAC 的程序集用于每个项目,而无需在 nuget-package 中使用它。
  • 这就是解决方案。谢谢!
猜你喜欢
  • 2012-05-21
  • 2010-12-11
  • 1970-01-01
  • 2018-08-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2023-03-18
  • 2013-06-20
相关资源
最近更新 更多