问题描述
我正在尝试为 .Net 核心 Web 应用程序添加身份验证,但是当我尝试运行代码时,即使我对系统具有完全访问权限,它也无法复制某些文件。
我按照此文档进行网络应用身份验证 link
我收到的错误是
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
解决方法
我在使用完全相同的 dll
文件时遇到了同样的问题。与 Tisa 建议将 dll
放在更短的路径中不同,我的项目是从我的用户文件夹中的 .nuget 文件夹中获取 dll
文件,例如:C:\Users\nameofuser\.nuget\...path...
我知道,我不应该修改加上修改后我不知道应该在哪里引用它。
因此,为了发布,我将我的项目移动到较短的路径位置,例如从 C:\Users\nameofuser\Documents\Visual Studio 2019\repo\Github\projectfolder
到 C:\Users\nameofuser\Desktop\projectfolder
,并且效果很好。 确保在将项目复制/移动到其他位置后向 Visual Studio 授予相关文件权限。