在Azure中,如何解决错误"ValidateServiceFiles任务意外失败"?

Bri*_*ing 6 validation azure visual-studio-2012

使用Azure SDK版本2.2时,此错误显示在我的Visual Studio 2012错误列表中.

它还引用了一个文件:

        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.
Run Code Online (Sandbox Code Playgroud)

该文件肯定存在并具有正确的属性.奇怪的是文件不在给定的路径中,它在另一条路径中.就好像ValidateServiceFiles进程混淆并在错误的文件夹中查找文件一样.

重新加载Azure辅助角色项目和云项目没有帮助,也没有重新启动计算机.有时可以通过在解决方案中手动构建每个云项目来取得进展.但是错误总是会返回,有时在从源代码控制获取最新信息后,尽管它本质上是随机的.

详细的构建日志显示了这一点:

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'.
Run Code Online (Sandbox Code Playgroud)

但这没有用.该文件存在于项目中的正确位置(不是错误消息中给出的路径)

关于如何调试ValidateServiceFiles进程,互联网上几乎没有帮助.

Bri*_*ing 1

经过多次搜索,我找到了答案。我有 3 个引用来发布配置文件,但这些文件实际上并不存在于磁盘上,如蓝色问号所示。

在此输入图像描述