Ben_G
Ben_G

Reputation: 826

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. 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. 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. I've also tried adding a reference to the the .dll in the \release folder but I get:

enter image description here

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. In VS2017 they all say "(Visual Studio 2013)" next to them so I assume that's what they're targeting.

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?

Upvotes: 0

Views: 166

Answers (1)

Ben_G
Ben_G

Reputation: 826

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

Upvotes: 1

Related Questions