简体   繁体   English

项目引用另一个项目的obj文件夹中的dll-有时有时不编译

[英]Project refers to dlls in another project's obj folder - compiles sometimes other times not

I have a large primarily C# solution in Visual Studio (around 24 projects within it) and (at least) two of the projects (.csproj files) have references to other project's (C++) .dll files in their obj folders. 我在Visual Studio中有一个大型的主要C#解决方案(其中约有24个项目),并且(至少)两个项目(.csproj文件)在其obj文件夹中都引用了其他项目的(C ++).dll文件。 Sometimes it compiles and sometimes it doesn't. 有时会编译,有时则不会。 When it compiles I'm able to look at the properties of the reference and see that it's pointing to the obj folder for the .dlls. 编译时,我可以查看引用的属性,并看到它指向.dlls的obj文件夹。 When it doesn't compile those references are blank. 不编译时,这些引用为空。

I've tried adding a reference directly to the .vcxproj but I get an error saying a reference to ___ could not be added . 我尝试将引用直接添加到.vcxproj,但出现错误,提示无法添加对___的引用 I've also tried adding a reference to the the .dll in the \\release folder but I get: 我也尝试在\\ release文件夹中添加对.dll的引用,但得到:

在此处输入图片说明

I should probably add that some of these C++ libraries were built back using VS 2005 and I have no idea if they've been upgraded properly. 我可能应该补充一点,其中一些C ++库是使用VS 2005重建的,我不知道它们是否已正确升级。 In VS2017 they all say "(Visual Studio 2013)" next to them so I assume that's what they're targeting. 在VS2017中,他们旁边都说“(Visual Studio 2013)”,所以我认为这就是他们的目标。

So ultimately my question is why would someone have added the references from the obj folder and how do I get this to build reliably? 因此,最终我的问题是,为什么有人会从obj文件夹中添加引用,以及如何使它可靠地构建?

I fixed this in and odd way that possibly may not want to be used by others, but I thought I'd post the solution anyway. 我以一种奇怪的方式解决了这个问题,它可能不希望被其他人使用,但是我认为我还是会发布解决方案。 I went to a good build (on the build server) and harvested those (temporary) .dlls from the obj folders and put them in a permanent location (checked into source control) and added direct references to them. 我去了一个好的构建(在构建服务器上),并从obj文件夹中收获了这些(临时).dll,并将它们放在一个永久的位置(检入源代码管理)并为其添加了直接引用。 Now the problem has gone away. 现在问题已经解决了。 Note that I did have to change "Embed Interop Types" to True for all of the .dlls (it defaults to False). 请注意,我确实必须将所有.dll的“嵌入互操作类型”更改为True(默认为False)。 Of course if the code that builds those .dlls changes we'll have to regenerate them and update them in source control, but they're all really old and we don't anticipate that being a problem for us. 当然,如果构建这些.dll的代码发生更改,我们将不得不重新生成它们并在源代码管理中对其进行更新,但是它们的确过时了,我们并不认为这对我们是个问题。

Good luck! 祝好运! I have no idea why there were references to .dlls in the obj folder to begin with. 我不知道为什么在obj文件夹中一开始就引用.dll。

Ben

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

相关问题 引用的DLL驻留在项目的\\ bin \\ Debug文件夹中是否可以接受? - Is it Acceptable for Referenced DLLs to reside in the project's \bin\Debug folder? .NET 中另一个项目使用的项目中引用的 DLL - DLLs referenced in a project used by another project in .NET 如何将第三方dll从bin文件夹移动到ASP.NET Web Forms项目中的另一个文件夹? - How to move third party dlls from bin folder to another folder in ASP.NET Web Forms project? 当项目需要引用其他dll时 - when project needs reference to other dlls 子项目引用的某些DLL未复制到Solution的输出文件夹 - Some DLLs referenced by sub-project not being copied to Solution's output folder 构建项目的组件以拥有.dll - Build project's components to own .dlls 从另一个项目进行引用时,并非库的所有引用DLL都在本地复制 - Not all of a library's refrenced DLLs are copied local when refrencing from another project 发布ASP .NET Web项目后项目的dll丢失 - Project`s dlls missing after publish asp .net web project 将dll存储在与bin不在同一项目中的另一个文件夹中 - store dll in another folder not in same project other than bin 访问项目应用程序文件夹中的程序集dll时出现FileLoadException - FileLoadException while accessing assembly dlls in project application folder
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM