Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not able to copy file in .Net application

I am trying to add authentication for .Net core web app, but when I try to run the code it is unable to copy some files even though I have full access to the system.

I following this doc for web app authentication link

Error that I am receiving is

Error   MSB3027 Could not copy "C:\Users\userName\.nuget\packages\system.security.cryptography.protecteddata\4.5.0\
runtimes\win\lib\netstandard2.0\System.Security.Cryptography.ProtectedData.dll" to 
"bin\Debug\netcoreapp3.1\runtimes\win\lib\netstandard2.0\System.Security.Cryptography.ProtectedData.dll". 
Exceeded retry count of 10. Failed.
WebApp-OpenIDConnect-DotNet C:\Program Files (x86)\Microsoft Visual Studio
\2019\Community\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets 4364    

like image 535
bippan Avatar asked Jan 29 '26 06:01

bippan


2 Answers

I had the same problem with exact same dll file. Unlike Tisa suggested to put the dll to a shorter path, my project was getting the dll file from .nuget folder from my user folder like: C:\Users\nameofuser\.nuget\...path... which I knew, I shouldn't modify plus I had no idea after modification where should I reference it.

So, for publishing, I moved my project to a shorter path location such as from C:\Users\nameofuser\Documents\Visual Studio 2019\repo\Github\projectfolder to C:\Users\nameofuser\Desktop\projectfolder and it worked fine. Make sure to grant relevant file permissions to Visual Studio after copying/moving the project to a different location.

like image 83
Jamshaid K. Avatar answered Jan 31 '26 21:01

Jamshaid K.


you have to move the folder of project to shorter path , it solved

like image 21
Ali A. Dabwan Avatar answered Jan 31 '26 21:01

Ali A. Dabwan