Assembly referenced in csproj is not copied to output directory

<ItemGroup>
    <Reference Include="Microsoft.WindowsAzure.Configuration">
        <HintPath>..\Microsoft.WindowsAzure.Configuration.dll</HintPath>
        <Private>true</Private>
    </Reference>
    <Reference Include="Microsoft.WindowsAzure.Storage">
        <HintPath>..\Microsoft.WindowsAzure.Storage.dll</HintPath>
        <Private>true</Private>
    </Reference>
</ItemGroup>

The reason is that is because I don't want all assemblies from all .NET Core to get copied to my output folder.

Now setting Copy Local to Yes in Visual Studio equals to <Private>true</Private> in csproj file.

The problem is, these DLL files are not getting copied to the output directory. What's more irritating is that I've added the same exact line of codes to a similar project, and only one of the files is getting copied to the output.

What can be the problem here? How do I debug this? I've made sure that these file exist and their relative path are correct.

Upvotes: 0

Views: 3554

Answers (1)

Leo Liu
Leo Liu

Reputation: 76928

What can be the problem here? How do I debug this? I've made sure that these file exist and their relative path are correct.

According to your description, I have created a Console App (.NET Core) with target framework .net core 2.0, add your code snippet into the .csproj file. All Dll files are copy to the output directory without any error.

To debug this issue, I suggest you could double check the relative path of Dll files(Though you have make sure it) and the output path:

To double check the relative path of Dll files:

Since you are reference the dll file to your project directly, you can check the Assemblies whether exists yellow warning symbol or not:

enter image description here

To make sure the relative path is correct, we could add the dll file manually: Right click the Dependencies->Add reference->Browse->Select the dll file and add it.

The output path:

The default output path of .net core project should be: bin\Debug\netcoreapp2.0\. When you set Copy Local to Yes, the dll files will copy to the folder bin\Debug\netcoreapp2.0\. If dll files not copy to that folder, please check the output path of your project: Properties->Build->Output path.

If above info nor help you debug this issue, please share more info to us, for example, the project type, the .csproj file or any other special settings for this project.

Upvotes: 1

Related Questions