Xamarin:"XamlCTask"任务意外失败。进程无法访问文件异常



我创建了一个Xamarin项目。当我构建项目时,我会出现以下错误。

严重性代码描述项目文件行抑制状态 错误的" XamlCtask"任务出乎意料地失败。 system.io.ioexception:该过程无法访问文件 'd: my csharpprojects samplexamarin sampleform sampleform.android obj obj debug 81 sampleform.android.dll' 因为它是由另一个过程使用的。

服务器堆栈跟踪:在system.io .__ error.winioerror(int32) 错误代码,字符串可能fullpath)at system.io.filestream.init(字符串路径,filemode模式,fileaccess 访问,INT32权利,布尔用户视频,文件共享,INT32 BufferSize,FileOptions选项,Security_Attributes secattrs,字符串 MSGPATH,布尔弗普莫克斯(Brolean bfromproxy),布尔uselongpath,布尔核电座椅)
在system.io.io.filestream..ctor(字符串路径,filemode模式,fileaccess) 访问,文件共享) mono.cecil.moduledefinition.ReadModule(字符串文件名, 读者参数参数) mono.cecil.semblyDefinition.ReadAssembly(字符串文件名, 读者参数参数) xamarin.forms.build.tasks.xamlctask.execute(ilist`1& thrownexceptions) 在xamarin.forms.build.tasks.xamltask.execute()at system.runtime.remoting.messaging.stackbuildersink.__privateProcessMessage(intptr MD,Object [] Args,Object Server,Object []&OUTARGS) system.runtime.remoting.messaging.stackbuildersink.syncprocessmessage(iMessage msg)

例外[0] System.Runtime.Remoting.proxies.RealProxy.HandLereturnMessage(iMessage reqmsg,imessage retmsg)at System.Runtime.Remoting.proxies.RealProxy.PrivateInvoke(Messagedata& micsgdata,int32 type)at microsoft.build.framework.itask.execute()
在 microsoft.build.backend.taskexecutionhost.microsoft.build.backend.itaskexecutionhost.execute() 在 microsoft.build.backend.taskbuilder.d__26.movenext()iLiidit.android

我尝试重新启动Visual Studio。甚至尝试重新启动窗口。但是没有运气。不确定为什么编译器无法访问sampleform.android.dll文件。

工具集配置

  • Microsoft Visual Studio Community 2017版本15.9.6VisualStudio.15.Release/15.9.6 28307.344 Microsoft .NET框架版本4.7.03056
  • Xamarin 4.12.3.79(D15-9@260FA6A34)Visual Studio扩展到启用Xamarin.ios和Xamarin.android的开发。
  • Xamarin设计师4.16.13(45A16EFD4)视觉工作室扩展到在Visual Studio中启用Xamarin Designer工具。
  • Xamarin模板1.1.128(6F5EBB2)用于构建iOS的模板,Android,以及带有Xamarin和Xamarin.forms的Windows应用程序。
  • Xamarin.android SDK 9.1.5.0(head/4B951A3E7)Xamarin.android参考组件和MSBUILD支持。
  • Xamarin.ios和Xamarin.Mac SDK 12.2.1.12(65ec520)
  • Xamarin.ios和Xamarin.mac参考组件和MSBUILD支持。

在xamarin.forms构建过程中发生了什么,在这种情况下:

  1. Roslyn/CSC将您的C#代码编译到.NET组装中
  2. XAMLC然后通过修改事实后修改组件来编译您的XAML

中间的某些过程打开了文件,它可能是防病毒软件还是Windows Defender?为您的项目目录添加Windows Defender排除是否可以解决问题?如果您只是尝试再次构建,它会消失吗?

最新更新