更新visual studio版本后,我的Xamarin Forms项目没有构建,显示了以下错误。我试图创建一个空白的应用程序,但同样的错误发生了。
错误:
Severity Code Description Project File Line Suppression State
Error The "ManifestMerger" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'D:GITAppBlankAppBlankAppBlank.AndroidobjDebug110androidAndroidManifest.xml.tmp'.
File name: 'D:GITAppBlankAppBlankAppBlank.AndroidobjDebug110androidAndroidManifest.xml.tmp'
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)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at Xamarin.Android.Tasks.ManifestDocument..ctor(String templateFilename)
at Xamarin.Android.Tasks.ManifestMerger.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext() AppBlank.Android
输出构建:
Rebuild started...
Restored D:GITAppBlankAppBlankAppBlankAppBlank.csproj (in 29 ms).
1>------ Rebuild All started: Project: AppBlank, Configuration: Debug Any CPU ------
Restored D:GITAppBlankAppBlankAppBlank.AndroidAppBlank.Android.csproj (in 99 ms).
1>AppBlank -> D:GITAppBlankAppBlankAppBlankbinDebugnetstandard2.0AppBlank.dll
2>------ Rebuild All started: Project: AppBlank.Android, Configuration: Debug Any CPU ------
2> AppBlank.Android -> D:GITAppBlankAppBlankAppBlank.AndroidbinDebugAppBlank.Android.dll
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: The "ManifestMerger" task failed unexpectedly.
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: System.IO.FileNotFoundException: Could not find file 'D:GITAppBlankAppBlankAppBlank.AndroidobjDebug110androidAndroidManifest.xml.tmp'.
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: File name: 'D:GITAppBlankAppBlankAppBlank.AndroidobjDebug110androidAndroidManifest.xml.tmp'
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): 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>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy, RequestCachePolicy cachePolicy)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlTextReaderImpl.FinishInitUriString()
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at Xamarin.Android.Tasks.ManifestDocument..ctor(String templateFilename)
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at Xamarin.Android.Tasks.ManifestMerger.Execute()
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
2>D:Arquivos de ProgramasMicrosoft Visual Studio2019CommunityMSBuildXamarinAndroidXamarin.Android.Common.targets(1448,3): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
========== Rebuild All: 1 succeeded, 1 failed, 0 skipped ==========
为了纠正错误,我尝试将Xamarin.Forms版本降级到4.6.0.847版本,并在AndroidManifest.xml中添加工具,但不起作用。
环境:
适用于Windows 的Microsoft Visual Studio社区2019版本16.10.3
Xamarin.Android SDK 11.3.0.4
Xamarin表格5.0.0.2083
目标框架:Android 11.0(R(
复制:https://github.com/FlavineiOliveira/AppBlank
现在问题已经解决了,但我不知道发生了什么。
之前,我尝试过:
- 清洁和重建解决方案
- 删除文件夹bin、obj并重建解决方案
- 更新和降级Xamarin.Forms版本
- 关闭并打开要重建的解决方案
- 重新启动我的计算机
- 修复Visual Studio
- 卸载并安装Visual Studio
现在,我只打开解决方案并尝试重建
成功
环境是一样的。