Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Build Error -> Microsoft.DotNet.Common.Targets: DLL could not be 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

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

My Problem is when I am building my solution, it seems ClassLibrary1 couldn't find the dll of Redis since the dlls are placed in artifact folder in the solution's directory.

If I check the Build Output, 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: of Microsoft.DotNet.Common.Targets

enter image description here

It seems the dlls are built and placed in the artifacts folder directory in the project solution. The File System Struture of the project is:

enter image description here

There is no any bin folder in the Cahing projects, how i can change that to make the bins generated in their corresponding projects?

like image 588
Hussein Salman Avatar asked Nov 03 '16 20:11

Hussein Salman


People also ask

Where is Microsoft common CurrentVersion targets?

NET projects are defined in the Microsoft. Common. CurrentVersion. targets file which can be found in the MSBuild bin directory.

How do you check if .NET framework is installed?

The version of . NET Framework (4.5 and later) installed on a machine is listed in the registry at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full. If the Full subkey is missing, then . NET Framework 4.5 or above isn't installed.

What is Microsoft CSharp targets?

Microsoft.CSharp.targets. Defines the steps in the standard build process for Visual C# projects. Imported by Visual C# project files (.csproj), which include the following statement: <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />


1 Answers

I checked the xproj file for Caching projects, it contains the build 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 its project folder directory

  1. BaseIntermediateOutputPath -> .\obj\$(MSBuildProjectName)

  2. OutputPath -> .\bin\

Then, the classLibrary1 can find the required referenced dlls now.

like image 173
Hussein Salman Avatar answered Nov 15 '22 06:11

Hussein Salman