简体   繁体   English

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

[英]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 工具集配置

  • Microsoft Visual Studio Community 2017 Version 15.9.6 VisualStudio.15.Release/15.9.6+28307.344 Microsoft .NET Framework Version 4.7.03056 Microsoft Visual Studio Community 2017版本15.9.6 VisualStudio.15.Release / 15.9.6 + 28307.344 Microsoft .NET Framework版本4.7.03056
  • Xamarin 4.12.3.79 (d15-9@260fa6a34) Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android. Xamarin 4.12.3.79(d15-9 @ 260fa6a34)Visual Studio扩展,用于启用Xamarin.iOS和Xamarin.Android的开发。
  • Xamarin Designer 4.16.13 (45a16efd4) Visual Studio extension to enable Xamarin Designer tools in Visual Studio. Xamarin Designer 4.16.13(45a16efd4)Visual Studio扩展,用于在Visual Studio中启用Xamarin Designer工具。
  • Xamarin Templates 1.1.128 (6f5ebb2) Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms. Xamarin模板1.1.128(6f5ebb2)用于使用Xamarin和Xamarin.Forms构建iOS,Android和Windows应用程序的模板。
  • Xamarin.Android SDK 9.1.5.0 (HEAD/4b951a3e7) Xamarin.Android Reference Assemblies and MSBuild support. Xamarin.Android SDK 9.1.5.0(HEAD / 4b951a3e7)Xamarin.Android参考程序集和MSBuild支持。
  • Xamarin.iOS and Xamarin.Mac SDK 12.2.1.12 (65ec520) Xamarin.iOS和Xamarin.Mac SDK 12.2.1.12(65ec520)
  • Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support. Xamarin.iOS和Xamarin.Mac参考程序集和MSBuild支持。

What happens during a Xamarin.Forms build, in this case: 在Xamarin.Forms构建过程中会发生什么,在这种情况下:

  1. Roslyn/Csc compiles your C# code into a .NET assembly Roslyn / Csc将您的C#代码编译为.NET程序集
  2. XamlC then compiles your XAML by modifying the assembly after the fact XamlC然后通过在事实发生后修改程序集来编译XAML

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.

相关问题 “ XamlCTask”任务意外失败。 该怎么办? - The “XamlCTask” task failed unexpectedly. What to do? “ ResolveLibraryProjectImports”任务意外失败。 Mac上的Xamarin.Android - The “ResolveLibraryProjectImports” task failed unexpectedly. Xamarin.Android on Mac “GenerateBindingRedirects”任务意外失败。 指定的路径,文件名或两者都太长 - The “GenerateBindingRedirects” task failed unexpectedly. The specified path, file name, or both are too long Docker 构建:“ContainerBuildAndLaunch”任务意外失败。 无法加载文件或程序集“Microsoft.Win32.Registry - Docker Build : The "ContainerBuildAndLaunch" task failed unexpectedly. Could not load file or assembly 'Microsoft.Win32.Registry “ LinkAssemblies”任务意外失败。 错误:XA2006 - The “LinkAssemblies” task failed unexpectedly. error: XA2006 “FilterByItems”任务意外失败。 Azure Web 应用程序发布 - The "FilterByItems" task failed unexpectedly. Azure WebApp Publish Xamarin“GenerateResourceDesigner”任务意外失败,找不到.dll文件 - Xamarin “GenerateResourceDesigner” task failed unexpectedly and .dll file could not be found “ EnsureBindingRedirects”任务意外失败。 System.Xml.XmlException:XML注释不能包含“-” - The “EnsureBindingRedirects” task failed unexpectedly. System.Xml.XmlException: An XML comment cannot contain '--' 是什么导致错误“The ResolveManifestFiles”任务意外失败。路径中的非法字符 - What causes the error “The ”ResolveManifestFiles" task failed unexpectedly. Illegal characters in path MSB401 “ResolveLibraryProjectImports”任务意外失败。 System.IO.IOException - MSB401 The "ResolveLibraryProjectImports" task failed unexpectedly. System.IO.IOException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM