问题
Suddenly I cannot rebuild my project in VS 2017. I get these messages:
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4222,5): error MSB3021: Unable to copy file "C:\Program Files (x86)\Reference Assemblies\Microsoft\FSharp\.NETFramework\v4.0\4.4.1.0\FSharp.Core.dll" to "bin\Debug\FSharp.Core.dll". Access to the path 'bin\Debug\FSharp.Core.dll' is denied.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(4222,5): error MSB3021: Unable to copy file "H:\Dropbox\BitBucket\VSProjects\Fractal10\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll" to "bin\Debug\Newtonsoft.Json.dll". Access to the path 'bin\Debug\Newtonsoft.Json.dll' is denied.
Any suggestions on how to solve this problem?
回答1:
Possible causes:
- The app you are trying to build/debug can be running or stuck open
- Tests locking the assemblies could be using them
- post-build steps listed in the properties page of a project could be using them
- while building multiple projects in parallel: another project could have decided to use those
dll
in the output folder for those references - Visual Studio's F# interactive if set to not shadow copy assemblies could cause it.
- anything else that causes a file to be locked in windows
来源:https://stackoverflow.com/questions/45898320/why-am-i-getting-access-denied-to-these-files