Visual Studio Build Error & # 8594; Microsoft.DotNet.Common.Targets: DLL not found

I am using Visual Studio 2015 Update 3, where I am using NET Core, I have three class libraries. Here are my class libraries:

enter image description here

  • Links ClassLibrary1 -> Microsoft.Extensions.Caching.Redis
  • ClassLibrary1 uses .NETCoreApp 1.0, while Redis caching uses .NET Standard 1.5

My problem is that when I create my solution, it seems that ClassLibrary1 could not find the DLL for Redis, since the dll libraries are placed in the artifact folder in the solutions directory.

If I check Build Build, it says that:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets(262,5) error : C:\Caching-1.0.0\src\ClassLibrary1\error CS0006: Metadata file 'C:\Caching1.0.0\src\Microsoft.Extensions.Caching.Redis\bin\Debug\netstandard1.5\Microsoft.Extensions.Caching.Redis.dll' could not be found 

Line 262: from Microsoft.DotNet.Common.Targets

enter image description here

It seems that the dlls are built and placed in a directory of artifact folders in the project solution. Struture project file system:

enter image description here

Cahing projects don't have any bin folder, how can I change it to make bins generated in their respective projects?

+5
source share
1 answer

I checked the xproj file for caching projects, it contains assembly information, where it redirects the output to the artifact folder:

 <BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath> <OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\</OutputPath> 

I changed both of them to point to the directory of his project folder

  • BaseIntermediateOutputPath โ†’ .\obj\$(MSBuildProjectName)

  • OutputPath โ†’ .\bin\

Then the class Library1 can now find the required reference dlls.

+5
source

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


All Articles