Xamarin Studio Error MSB4018: The “ConvertResourcesCases” task failed unexpectedly

核能气质少年 提交于 2019-12-30 10:59:51

问题


I am getting the following error while trying to build my solution. I am trying to update an existing project that I haven't touched for a few months. Its location in my PC has not changed.

C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(2,2): Error MSB4018: The "ConvertResourcesCases" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'obj\Debug\res\anim\slide_out_left.xml'.
File name: 'obj\Debug\res\anim\slide_out_left.xml'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite, Boolean checkHost)
at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite)
at Xamarin.Android.Tools.Files.CopyIfChanged(String source, String destination)
at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources(ITaskItem item, Dictionary2 acwMap)
at Xamarin.Android.Tasks.ConvertResourcesCases.FixupResources(Dictionary2 acwMap)
at Xamarin.Android.Tasks.ConvertResourcesCases.Execute()
at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() (MSB4018) (TekaTekiMalaysia.Droid)

I've read from the other thread that I've to 'Unblock' the file via File Explorer but such option is not available for me under properties.

I've also tried moving the solution to a different folder up the folder tree.

I've also tried changing the folder properties by giving it Full Control permission.

I am using Xamarin Studio to build the project. Any ideas what is causing the issue?


回答1:


Deleting bin and debug folder/Changing the solution directory name nothing worked, I solved it by moving the solution from "C:\Users\Dell PC\Desktop\studies\SampleProjects\Xamarin\XamarinFCM" to "C:\XamarinSamples\XamarinFCM"

What I feel is xamarin solution expect a shorter directory path. not sure why Microsoft leave this kind of bug.




回答2:


OK I finally figured it out. For the benefit of those encountering the same problem here's how I fix it. It's caused by any non English character in the root solution folder.

For example my original solution location is

D:\Users\OneDrive\Dev\Xamarin\TekaTeki3\TekaTeki3\

I created a new folder and rename the folder from TekaTeki3 to TekaTekiTiga. Now it compiles properly!

D:\Users\OneDrive\Dev\Xamarin\TekaTekiTiga\TekaTeki3\



回答3:


I fixed this by cleaning my solution, deleting the obj and bin directories in my .Droid project and rebuilding.




回答4:


I imagine there's a bug but here's a workaround:

The error is telling us it can't find a directory.

Create the directories manually, then rebuild. There will be 3 new missing directory complaints - just manually create those directories as well.

Rebuild-All should work now.




回答5:


For me this Solution works, I have only shorten the Path of solution like,

previously it was

D:\Projects\Xamarin_Projects\Git_Test\WCP_Solution

I shifted my project location to shorter path like

D:\Projects\WCP_Solution

because there is character limit Android solution




回答6:


I just had the same problem. The fix was add "READ & WRITE" on root folder and **rebuild **the project.



来源:https://stackoverflow.com/questions/34713786/xamarin-studio-error-msb4018-the-convertresourcescases-task-failed-unexpected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!