VS 2015-related DLLs updated in the bin dir web application, even though

It drives us crazy:

  • Create a new solution in VS 2015.
  • Add a class project called Dependency
  • Add a blank web app called Consumption
  • In the Dependency section, add a link to the Castle.Core link, version 2.5.2
  • In the Consumption section, add a nuget link to Castle.Core, version 3.3.3 (you can use pacakges.config or project.json - it doesn't matter)
  • Add a link to the project from the Consumption section in the Dependency

Now create your entire sln and explore the Castle.Core version in the bin directory "Consuming" - confident enough that it will be 3.3.3, as expected.

However, now create a project only from Dependencies. Magically, Castle.Core DLL, located in the bin directory "Consuming", is updated to 2.5.2, even if the construction of "Dependency" should not run the assembly "Consumption"

Now repeat the same process, but make Consuming a console application - it won’t!

What the hell is going on here?

(I'm sure this is not related to nuget: I think this will happen with regular assembly references)

Update @ Schwarzie2478 Ask me to try the same sequence using MSBuild on the command line. As I expected, the observed behavior above does not occur, so this is only a problem with VS:

  • Starting with clean bin folders, MSBuild sln:
PS v5 (0.0140067) D:\Temp\DependencyTest\DependencyTest> msbuild /t:Build .\DependencyTest.sln
....
Project "D:\Temp\DependencyTest\DependencyTest\DependencyTest.sln" (1) is building "D:\Temp\DependencyTest\DependencyTest\WebApp\WebApp.csproj" (4) on node 1 (default targets).
....
_CopyFilesMarkedCopyLocal:
  Copying file from "D:\Temp\DependencyTest\DependencyTest\packages\Castle.Core.3.3.3\lib\net45\Castle.Core.dll" to "bin\Castle.Core.dll".
    ...

DLL WebApp\bin\debug 3.3.3

- "" :

PS v5 (2.8423647) D:\Temp\DependencyTest\DependencyTest> msbuild /t:build .\Dependency\Dependency.csproj
...
Project "D:\Temp\DependencyTest\DependencyTest\Dependency\Dependency.csproj" on node 1 (build target(s)).
...
CoreCompile:
Skipping target "CoreCompile" because all output files are up-to-date with respect to the input files.
CopyFilesToOutputDirectory:
  Dependency -> D:\Temp\DependencyTest\DependencyTest\Dependency\bin\Debug\Dependency.dll
Done Building Project "D:\Temp\DependencyTest\DependencyTest\Dependency\Dependency.csproj" (build target(s)).

, "Consuming" bin WebApp.

- , , SLN, unit test, , R #, unit test, WebApplications sln , unit test .

+4

Source: https://habr.com/ru/post/1649158/


All Articles