In Azure, how to fix the error "ValidateServiceFiles validation failed unexpectedly"?

This error appears in my Visual Studio 2012 error list when using the Azure SDK version 2.2.

It also refers to 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. It is strange that the file is not in the specified path, but in a different path. It is as if the ValidateServiceFiles process is confused and is looking for a file in the wrong folder.

Rebooting the Azure user role project and cloud projects does not help, does not restart the computer. Sometimes you can make progress by manually creating each cloud project in the solution. But the error always returns, sometimes after receiving the last from the initial control, although it is essentially random.

A detailed build log shows 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 that does not help. The file exists in the correct place in the project (not the path specified in the error message)

There is little to learn on the Internet about how to debug the ValidateServiceFiles process.

+6
source share
2 answers

After a long search, I found the answer. I had 3 links for publishing profile files that did not physically exist on the disk, as shown by a blue question mark.

enter image description here

+1
source

The arbitrary nature of this problem is that if someone removes the cloud service on the Azure portal, the assembly on your local computer does not work. This is because the ValidateServiceFiles function verifies that your publish profile files contain links to existing cloud services in the Azure portal.

But the error message does not mention which project has the problem, simply listing all of them.

So, right-click each cloud project, then click publish and make sure you are not getting any red crosses.

enter image description here

+3
source

All Articles