Preventing MSBuild from replacing my binary dlls #10452
Replies: 3 comments 5 replies
-
Can you share a binary log ( |
Beta Was this translation helpful? Give feedback.
-
hey, we need some time to gather information. |
Beta Was this translation helpful? Give feedback.
-
@rainersigwald , sorry it took a while for us to prepare. This single folder already contains a predetermined version of certain 3rd party dependencies (e.g. To give a somewhat contrived example, in our project we might reference This is not what happens. Our investigation so far shows that We haven't been able to find a simple way to make sure the binary reference takes precedence. The best attempt we've had is explicitly adding transitive binary references to every project where this is needed, followed by a custom target which will eliminate duplicate references from a package. The source for our custom target is attached below:
Also I'm sending a zip file with binlog and the whole sample project where we have reproduced an issue |
Beta Was this translation helpful? Give feedback.
-
My projects get some dlls as binary references. We have
build
folder and some dlls are copied to that folder and we reference that dlls in our projects. Example:At the same time our projects get some dlls from nuget packages. So our projects have references to some packages.
The problem is that default MSBuild behavior will replace some of our binary referenced dlls with some stuff which it got from nuget package. I'll explain:
A.dll
is binary reference, it's in abuild
folderB.dll
is in nuget package and it referencesA.dll
. A.dll is also stored as nuget package in nuget package cachewhen we run MSBuild it copies
B.dll
from nuget package to build folder and overrides ourA.dll
with that one from nuget packageand overrides our
A.dll
with that one.We want to disable this. We want MSBuild to keep our dlls and not to do any replacement
The possible workaround is to use
ExcludeAssets
forB.dll
. The problem is that by doing that we only resolve current problems but we don't protect us from having troubles in the future. If somebody adds new nuget package and we don't doExludeAssets
the same problem will reappear.We need some solution that will work always when user adds some new nuget package and that package inside it references to some other package which dll is actually the one we already have as binary reference.
Any thoughts?
Beta Was this translation helpful? Give feedback.
All reactions