项目是指另一个项目的obj文件夹中的dll - 有时其他时候没有编译

时间:2018-01-30 22:17:40

标签: c# c++ visual-studio

我在Visual Studio中有一个主要的C#解决方案(其中大约有24个项目)和(至少)两个项目(.csproj文件)引用了其他项目的(C ++)。dll文件他们的obj文件夹。有时它会编译,有时它不会编译。编译时,我能够查看引用的属性,并看到它指向.dll的obj文件夹。当它没有编译时,这些引用是空白的。

我已尝试直接向.vcxproj添加引用,但我收到错误消息,指出无法添加对___的引用。我还尝试在\ release文件夹中添加对.dll的引用,但我得到了:

enter image description here

我应该补充说,其中一些C ++库是使用VS 2005构建的,我不知道它们是否已正确升级。在VS2017中,他们都说"(Visual Studio 2013)"在他们旁边,所以我假设他们正在瞄准他们。

所以最终我的问题是为什么有人会添加obj文件夹中的引用,如何让它可靠地构建?

1 个答案:

答案 0 :(得分:1)

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. 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). 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.

Good luck! I have no idea why there were references to .dlls in the obj folder to begin with.

Ben