Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Azure, how do I troubleshoot the error "ValidateServiceFiles task failed unexpectedly"?

This error is showing up in my Visual Studio 2012 error list when using Azure SDK version 2.2.

It also references a file:

        Error   5   The "ValidateServiceFiles" task failed unexpectedly.
System.IO.FileNotFoundException: Could not find file 'C:\Project\Data.Contracts\ServiceConfiguration.Local.cscfg'.
File name: 'C:\Project\Data.Contracts\ServiceConfiguration.Local.cscfg'
   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)
   at Microsoft.ServiceHosting.Tools.Internal.Translations.Translate.ServiceConfigurationFromFile(Boolean useInternalSchema, String serviceConfigurationFile, ValidationHandler validationHandler)
   at Microsoft.ServiceHosting.Tools.MSBuildTasks.ValidateServiceFiles.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext() C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.2\Microsoft.WindowsAzure.targets  669 5   Azure.

The file definitely exists and has the correct attributes. The odd thing is that the file is not in the path given, it's in another path. It's as if the ValidateServiceFiles process is confused and looking for the file in the wrong folder.

Reloading the Azure worker role project and cloud projects doesn't help, neither does restarting the computer. Progress can sometimes be made by manually building each cloud project in the solution. But the error always returns, sometimes after getting latest from source control although it is essentially random.

A detailed build log reveals this:

58>C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Windows Azure Tools\2.2\Microsoft.WindowsAzure.targets(3259,5): warning MSB3026: Could not copy "ServiceConfiguration.Local.cscfg" to "bin\Debug\ServiceConfiguration.cscfg". Beginning retry 2 in 1000ms. Could not find file 'ServiceConfiguration.Local.cscfg'.

But this doesn't help. The file exists in the correct location in the project (not the path given in the error message)

There is little help on the internet about how to debug the ValidateServiceFiles process.

like image 337
Brian Leeming Avatar asked Apr 04 '14 18:04

Brian Leeming


1 Answers

After much searching, I found the answer. I had 3 references to publish profile files that did not physically exist on disk as shown by the blue question mark.

enter image description here

like image 147
Brian Leeming Avatar answered Nov 01 '22 12:11

Brian Leeming