Bug 23639 - Build now fails with resource files that are read/only
Summary: Build now fails with resource files that are read/only
Status: RESOLVED DUPLICATE of bug 23653
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Android ()
Version: 3.7
Hardware: PC Windows
: High major
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-10-06 05:45 UTC by info
Modified: 2014-10-06 13:55 UTC (History)
7 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED DUPLICATE of bug 23653

Description info 2014-10-06 05:45:53 UTC
Since I updated Xamarin.Android today, all builds fail with the the following error:

\Xamarin.Android.Common.targets(658,2): error MSB4018: The "CopyAndConvertResources" task failed unexpectedly.
\Xamarin.Android.Common.targets(658,2): error MSB4018: System.UnauthorizedAccessException: Access to the path 'C:\xxx.png' is denied.

This is because our resource files are always read/only due to our source control system. Builds did work without any problems until I updated Xamarin.Android today.

Installed versions:

Xamarin   3.7.201.0 (58a59ecb5fa40a0a2e97617c36c069074404c6ae)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.18.0.32 (04399d62cfc00624d575239d1762ea4fd6d012e2)
Visual Studio plugin to enable development for Xamarin.Android.
Comment 1 pragma.mobilexp 2014-10-06 08:13:05 UTC
Same issue here after the latest update for the same version info mentioned above

>------ Build started: Project: Pragma.OnKey.Mobile.Core.Android, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018: The "CopyAndConvertResources" task failed unexpectedly.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018: System.UnauthorizedAccessException: Access to the path 'C:\PragmaDev\OKSource\OnKey\Feature_Mobile\Source\Pragma.OnKey.Mobile.Core.Android\obj\Debug\res\drawable-hdpi\ic_globe.png' is denied.
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): 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)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at System.IO.File.OpenFile(String path, FileAccess access, SafeFileHandle& handle)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at System.IO.File.SetLastWriteTimeUtc(String path, DateTime lastWriteTimeUtc)
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at Xamarin.Android.Tasks.CopyAndConvertResources.Execute()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
1>C:\Program Files (x86)\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets(658,2): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()
Comment 2 Parmendra Kumar 2014-10-06 10:29:25 UTC
I have checked this issue and I am able to reproduce it. To reproduce it I have followed these steps:
1. Create a Android App
2. Add a image into resource folder
3. Set the image as read only
4. Use this image into Image-view
5. Build the project.
6. Error.

Screencast: http://www.screencast.com/t/ck6a9ZD8
Error:https://gist.github.com/Parmendrak/41b27cc67aab540a4945
ZipXam Log:https://gist.github.com/Parmendrak/69f73c286aec61d79af5

Environment Info:
Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Xamarin   3.7.201.0 (58a59ecb5fa40a0a2e97617c36c069074404c6ae)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android   4.18.0.32 (04399d62cfc00624d575239d1762ea4fd6d012e2)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS   8.2.0.0 (ff9d4a06f588a29e1db224ecd4216f68a9106299)
Visual Studio extension to enable development for Xamarin.iOS.
Comment 3 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-06 12:04:06 UTC
For tallying purposes, there are many reports of this on the forums:
http://forums.xamarin.com/discussion/25411/copyandconvertresources-task-failed-in-xamarin-3-7-201

And also several Desk cases.
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2014-10-06 13:55:34 UTC
Thanks for the reports! I was able to reproduce this problem on both OS X and Windows, so I filed a new bug to provide a clean starting point for that cross-platform problem.

The bug is a regression between Xamarin.Android 4.16 and Xamarin.Android 4.18, so you can downgrade back 1 stable version (to Xamarin 3.6.262 on Windows) to avoid this problem.

In my quick tests, it appeared that building the project twice in a row was one relatively simple way to work around the problem.

I'm marking this bug as a duplicate of the new cross-platform bug.

*** This bug has been marked as a duplicate of bug 23653 ***