Could not copy obj\Debug\net6.0\CMA.dll to bin\Debug\net6.0\CMA.dll. Exceeded retry count of 10. Failed. The file is locked by: Visual Studio 2022

Viewed 1055

I just upgraded to "Microsoft Visual Studio Community 2022 (64-bit) - Current Version 17.1.2" and while I try to compile the.Net core 6 web Application, it gets this error:

Severity Code Description Project File Line Suppression State Error MSB3027 Could not copy "obj\Debug\net6.0\CMA.dll" to "bin\Debug\net6.0\CMA.dll". Exceeded retry count of 10. Failed. The file is locked by: "Microsoft Visual Studio 2022 (8816)" CMA C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets 4631

When I double click the error message it opens the file Microsoft.Common.CurrentVersion.targets and highlights the part below:

    <!-- Copy the build product (.dll or .exe). -->
<Copy
    SourceFiles="@(IntermediateAssembly)"
    DestinationFolder="$(OutDir)"
    SkipUnchangedFiles="$(SkipCopyUnchangedFiles)"
    OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
    Retries="$(CopyRetryCount)"
    RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
    UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)"
    UseSymboliclinksIfPossible="$(CreateSymbolicLinksForCopyFilesToOutputDirectoryIfPossible)"
    ErrorIfLinkFails="$(ErrorIfLinkFailsForCopyFilesToOutputDirectory)"
    Condition="'$(CopyBuildOutputToOutputDirectory)' == 'true' and '$(SkipCopyBuildProduct)' != 'true'"
        >

  <Output TaskParameter="DestinationFiles" ItemName="MainAssembly"/>
  <Output TaskParameter="DestinationFiles" ItemName="FileWrites"/>

</Copy>

Any Idea what to do?

0 Answers
Related