Error creating smart device apps in vs2005

For some unknown reason following error message can appear after creating/building/reopening your solution in vs2005 upon a build:

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1616,9): error MSB4018: The “GenerateResource” task failed unexpectedly.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1616,9): error MSB4018: System.InvalidOperationException: Collection was modified; enumeration operation may not execute.

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1616,9): error MSB4018: at Microsoft.Build.Shared.ExceptionHandling.RethrowUnlessFileIO(Exception e)

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1616,9): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.NeedSeparateAppDomain()

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1616,9): error MSB4018: at Microsoft.Build.Tasks.GenerateResource.Execute()

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(1616,9): error MSB4018: at Microsoft.Build.BuildEngine.TaskEngine.ExecuteTask(ExecutionMode howToExecuteTask, Hashtable projectItemsAvailableToTask, BuildPropertyGroup projectPropertiesAvailableToTask, Boolean& taskClassWasFound)

The ‘work around’ at the moment is the following:

Edit your project file and add this to the first PropertyGroup:

true

Rebuild and voila !

As found in a post by Faisal Mohamood | Program Manager | Visual Studio - MSBuild

Leave a Reply