Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4613574
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:34:18+00:00 2026-05-22T01:34:18+00:00

In the process of cleaning up the folder/file structure on a project I inherited,

  • 0

In the process of cleaning up the folder/file structure on a project I inherited, I’m running into a problem with organizing the required external libraries. I want to keep them in their own .\dll\ folder, but they’re not being copied to the build directory properly. They should be in the root build directory, but they’re being moved to a subfolder instead.

My .csproj file contains the following xml:

<Project>
  <ItemGroup>
    <None Include="dlls\libraryA.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>

Then, on build, the libraryA.dll file is copied to the bin\Debug\dll\ folder, but I want it in the bin\Debug\ folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T01:34:19+00:00Added an answer on May 22, 2026 at 1:34 am

    I tried this and msbuild always wants to copy the files using their directory path, but there is a workaround…

    Edit the csproj file and after this line:

      <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    

    Add these lines:

      <PropertyGroup>
        <PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyCopyFilesToOutputDirectory</PrepareForRunDependsOn>
      </PropertyGroup>
    
      <Target Name="MyCopyFilesToOutputDirectory">
        <Copy SourceFiles="@(None)" DestinationFolder="$(OutDir)" />
      </Target>
    

    The copy of the output files happens in the PrepareForRun target. This adds your own target to the list of targets that are executed as part of PrepareForRun.

    This example copies all items in the None item group. You could create your own item group (e.g. MyFiles) and do the copy on that item group if you have other “None” files you don’t want copied. When I tried this I had to change the item group name by editing the csproj file directly. Visual Studio did not allow me to set the item group of a file from the UI, but after I edited the csproj and changed it, Visual Studio displayed my custom item group name correctly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK--I have a HUGE css file, inherited from another designer. I'm in the process
I've been going through the process of cleaning up our controller code to make
Current Process: I have a tar.gz file. (Actually, I have about 2000 of them,
The process is not running as WOW64, its running as x64 in an x64
The Story After cleaning up my Dreamhost shared server's home folder from all the
I’m in the process of cleaning up a database table. Due to the way
I'm in the process of cleaning up an Oracle database application. In this application,
I'm in the process of cleaning up a MySQL database and have to make
I'm currently in the process of stripping down, refactoring and cleaning up a medium
My situation is like this: Everytime before uploading war file to web-app folder, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.