由于访问 VS2017 中的路径错误,无法使用发布模式构建

Can not build with release mode because of Access to the path error in VS2017

当我尝试在发布模式下构建我的 xamarin uwp 项目时,出现以下错误;

**

2>"C:\Projects\etimkcp\MKCP\MKCP\MKCP.UWP\MKCP.UWP.csproj" (Rebuild target) (1) -> 2>(ComputeNativePackageInputsAndOutputs target) -> 2> C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: The "ComputeManagedBinaries" task failed unexpectedly. 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: System.UnauthorizedAccessException: Access to the path 'C:\Program Files (x86)\Windows Kits\UnionMetadata.0.15063.0\Windows.winmd' is denied. 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Cci.MemoryMappedFile.OpenFileMemoryMap(String filename, Byte*& buffer, UInt32& length) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Cci.MemoryMappedFile.CreateMemoryMappedFile(String localFileName, IBinaryDocument binaryDocument) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Cci.MetadataReaderHost.OpenBinaryDocument(IBinaryDocument sourceDocument) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Cci.PeReader.OpenModule(IBinaryDocument binaryDocument, ModuleIdentity& moduleIdentity) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Cci.PeReader.DefaultHost.LoadUnitFrom(String location) 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at ilc.ComputeManagedBinaries.Execute() 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() 2>C:\Users\Özge.nuget\packages\microsoft.net.native.compiler.7.0\tools\Microsoft.NetNative.targets(535,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

**

感谢您对此问题的任何想法。

Access to the path 'C:\Program Files (x86)\Windows Kits\UnionMetadata.0.15063.0\Windows.winmd' is denied.

您可以 运行 VS2017 Administrator 清理您的解决方案然后重建它。