Visual Studio 2019: Failure: Could not find a part of the path

翔 高 0 Reputation points
2023-02-02T01:48:16.85+00:00

When I use vs2019 16.8.4 to build an application,vs2019 will prompt:

Could not write to "obj\Debug".Could not find a part of the path"d:\code\abc\obj\Debug"

But when I press F5 or Ctrl+F5,vs2019 will build success and run application.

I try to change directory or change disk, and the result remains the same.

I try to create a new solution,and the result remains the same.

Everytime when I first press F5 of Ctrl + F5, vs2019 will prompt this error,and when I second press it, everything will be well.

How can I solve it?

Developer technologies | Visual Studio | Other
Community Center | Not monitored
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2023-02-02T08:17:06.3866667+00:00

    Hi @翔 高, 

    Welcome to Microsoft Q&A! 

    What is your project type? Are you building your application in Debug or Release configuration?

    Please check if you can find the <OutputPath> entry in your .csproj file. If so, please backup and delete it. 

    Then, refer to the link: Change the build output directory to reset the Output path. 

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

     


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.