[英]Xamarin: The “XamlCTask” task failed unexpectedly. The process cant access the file exception
I have created a xamarin project. 我创建了一个xamarin项目。 When i build the project i get following error. 当我构建项目时,出现以下错误。
Severity Code Description Project File Line Suppression State Error The "XamlCTask" task failed unexpectedly. 严重性代码说明项目文件行抑制状态错误“ XamlCTask”任务意外失败。 System.IO.IOException: The process cannot access the file 'D:\\my\\csharpprojects\\sampleXamarin\\sampleForm\\sampleForm.Android\\obj\\Debug\\81\\sampleForm.Android.dll' because it is being used by another process. System.IO.IOException:该进程无法访问文件'D:\\ my \\ csharpprojects \\ sampleXamarin \\ sampleForm \\ sampleForm.Android \\ obj \\ Debug \\ 81 \\ sampleForm.Android.dll',因为该文件正在由另一个进程使用。
Server stack trace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 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) 服务器堆栈跟踪:位于System.IO.FileStream.Init(字符串路径,FileMode模式,FileAccess访问权限,Int32权限,布尔useRights,FileShare共享,Int32 bufferSize,FileOptions,System.IO .__ Error.WinIOError(Int32错误代码,字符串可能是FullPath)选项,SECURITY_ATTRIBUTES secAttrs,字符串msgPath,布尔bFromProxy,布尔useLongPath,布尔checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters) at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters) at Xamarin.Forms.Build.Tasks.XamlCTask.Execute(IList`1& thrownExceptions) at Xamarin.Forms.Build.Tasks.XamlTask.Execute() at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg) 在System.IO.FileStream..ctor(字符串路径,FileMode模式,FileAccess访问,FileShare共享)在Mono.Cecil.ModuleDefinition.ReadModule(字符串fileName,ReaderParameters参数)在Mono.Cecil.AssemblyDefinition.ReadAssembly(字符串fileName,ReaderParameters)参数)在Xamarin.Forms.Build.Tasks.XamlCTask.Execute(IList`1和thrownExceptions)在Xamarin.Forms.Build.Tasks.XamlTask.Execute()在System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)上的Object [] args,对象服务器,Object []&outArgs)Exception rethrown at [0]: at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) at Microsoft.Build.Framework.ITask.Execute() 在[0]处引发异常:在Microsoft.Build处,System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)在System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg)处重新引发。 Framework.ITask.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() iliidit.Android 在Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()上的Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()iliidit.Android
I tried restarting visual studio. 我尝试重新启动Visual Studio。 Even tried restarting Windows. 甚至尝试重新启动Windows。 But no luck. 但是没有运气。 Not sure why the compiler is unable to access the sampleForm.Android.dll file. 不知道为什么编译器无法访问sampleForm.Android.dll文件。
Toolset configuration 工具集配置
What happens during a Xamarin.Forms build, in this case: 在Xamarin.Forms构建过程中会发生什么,在这种情况下:
Some process in the middle opened the file, could it be an antivirus software or Windows Defender? 中间的某个过程打开了文件,可能是防病毒软件还是Windows Defender? Does adding a Windows Defender exclusion for your project's directory solve the problem? 为项目目录添加Windows Defender排除项是否可以解决问题? If you just try to build again, does it go away? 如果您只是尝试再次构建,它会消失吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.