-2

I have a file that needs to be in the output directory for a project to run properly. If this file (a 3rd party dll) is in the main project directory with "Build Action" set to "None" and "Copy to Output Directory" set to "Copy always" it seems to work OK. BUT if I put this file into a sub-directory in the main project directory, it NEVER copies. There is no error, warning, nothing. And no, it does not copy to a sub-directory in the build directory either. Build just seems to ignore the setting.

Is this a bug with the build tool or Visual Studio? Does anyone know a work-around?

1 Answer 1

4

Manually edit the project file (.csproj):

<ItemGroup>
    <None Include="Subdirectory\Your3rdParty.dll">
        <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
</ItemGroup>
Sign up to request clarification or add additional context in comments.

2 Comments

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
After ensuring VS updated the subdirectory in the csproj file, you may also want to delete the obj and bin files, then perform a clean and build.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.