简体   繁体   English

未将引用的ClassLibrary的从属DLL添加到应用程序的BIN中

[英]Dependent DLLs of referenced ClassLibrary not added to BIN of application

There are so many questions posted about this issue. 有关此问题的问题太多了。 I believe i have read them all and still not having much luck. 我相信我已经阅读了所有内容,但仍然运气不佳。 I have a VS2015 project where i can do all that i have described below without issue. 我有一个VS2015项目,我可以毫无问题地完成下面描述的所有工作。 Also note that the process i went through to move the applications and class libraries from 2015 to 2017 was to fully rebuild them in 2017. In any case, i created a new solution in 2017 with new application and class library to prove my issue. 还要注意,我将应用程序和类库从2015年迁移到2017年所经历的过程是在2017年完全重建它们。无论如何,我在2017年使用新的应用程序和类库创建了一个新的解决方案来证明我的问题。

  1. I created a new library call ClassLibrary and a new asp.net web app called WebApplication . 我创建了一个名为ClassLibrary的新库和一个名为WebApplication的 asp.net Web应用程序。
  2. In ClassLibrary i then added a nuget for testing (i have also tested this with a file reference to a 3rd party DLL). 然后,我在ClassLibrary中添加了一个用于测试的nuget (我也使用对第三方DLL的文件引用对其进行了测试)。 In this case i added the AjaxControlToolkit 18.1.0 for testing. 在这种情况下,我添加了AjaxControlToolkit 18.1.0进行测试。
  3. Then in WebApplication project i reference ClassLibrary 然后在WebApplication项目中,我引用ClassLibrary

I would expect this simple solution and project referencing to copy the dependent DLLS of ClassLibrary to WebApplication project bin. 我希望这种简单的解决方案和项目引用能够将ClassLibrary的依赖DLLS复制到WebApplication项目bin中。 It does not. 它不是。 Prior to moving to VS 2017 this would (and still does in VS 2015) copy the dependency DLL of ClassLibrary in WebApplication's BIN. 在移至VS 2017之前,这将(并且仍然在VS 2015中执行)将ClassLibrary的依赖项DLL复制到WebApplication的BIN中。 In the VS2017 project i described above the AjaxControlToolkit is not copied to the BIN, i only see a ClassLibrary.dll but none of its dependencies. 在我上面描述的VS2017项目中,AjaxControlToolkit未复制到BIN,我只看到ClassLibrary.dll,但没有依赖项。

I have tried to "use" the AjaxControlToolkit in the WebApplication project code as some of the posts suggest. 正如一些帖子所建议的,我试图在WebApplication项目代码中“使用” AjaxControlToolkit。 This does not work as the assembly is not available in the project and i get build errors. 这不起作用,因为该程序集在项目中不可用,并且我收到构建错误。 I've modified the .csproj files in so many different ways based on suggestions i have found on Stack, nothing works. 根据我在Stack上发现的建议,我以多种不同方式修改了.csproj文件,但没有任何效果。

Whats even more strange is that i see the DLL in the bin but not listed in the project References. 更奇怪的是,我在垃圾箱中看到了DLL,但未在项目参考中列出。 Even though the DLL is in the bin i am unable to work with it. 即使DLL位于垃圾箱中,我也无法使用它。 在此处输入图片说明

What is going on? 到底是怎么回事? This is such a simple exercise of referencing and after spending two days on Google searching on this it seems crazy that so many have this issue. 这是一个非常简单的引用练习,在Google上进行了两天的搜索之后,似乎很多人都遇到了这个问题。 Why are these DLLs not flowing all the way to the parent application BIN??? 为什么这些DLL不能一直流到父应用程序BIN?

Thanks 谢谢

In my post i mentioned that these projects originally in VS2015 were then recreated in VS2017. 在我的帖子中,我提到最初在VS2015中创建的这些项目然后在VS2017中重新创建。 This process converted the original Web Site projects to Web Application projects. 此过程将原始网站项目转换为Web应用程序项目。

As mentioned here , in a Web Site project when a ClassLibrary is referenced as a project reference "Copies of dependent assemblies, XML document files, license files, resource files, and so on." 如前所述这里 ,在当ClassLibrary作为项目引用引用的网站项目“相关的组件,XML文档文件,许可文件,资源文件等的副本。” (this includes installed Nugets in the ClassLibrary) are copied to the project BIN. (这包括ClassLibrary中已安装的Nugets)被复制到项目BIN。 This is not the case with Web Applications. Web应用程序不是这种情况。 See here for the differences. 看到这里的差异。 Installing the NuGet wherever it is needed is required, it will not be inherited from child references as it is with Web Site projects. 无论在哪里需要安装NuGet,都不会像在Web站点项目中那样从子引用中继承它。

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

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