【发布时间】:2016-07-19 06:08:35
【问题描述】:
我有一个包含许多项目的大型解决方案文件。包括三个 Azure Web 角色项目。我们正在使用 MSBuild 来构建这样的解决方案:
<MSBuild
Projects="$(ProductRoot)\Product.sln"
Properties="Configuration=$(BuildConfiguration);OutputPath=$(OutputPath)\Product;OutDir=$(OutputPath)\Product\;TargetProfile=$(TargetProfile);CloudExtensionsDir=$(CloudExtensionsDir);ServiceHostingSDKInstallDir=$(ServiceHostingSDKInstallDir);AzureClientLibInstallDir=$(AzureClientLibInstallDir);GenerateProjectSpecificOutputFolder=true"
Targets="Build;Publish"/>
但是,对于我们的 Azure 项目,这是失败的: 错误CloudServices077:需要为角色WebService的虚拟路径'Web/'指定物理目录。
该解决方案在 Visual Studio 2015 中构建良好。
我不明白为什么它会因为这个错误而失败。我们的每个云项目中只有一个站点,不需要物理目录。这是来自 CSDEF:
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="WebService" />
</Bindings>
</Site>
</Sites>
我什至不知道我想为物理目录放什么。
为了增加更多的混乱,我发现如果我只使用 Build 目标 MSBuild 解决方案,然后使用 Publish 目标 MSBuild 我的每个云项目 (CCPROJ) 文件,那么它工作正常!但我需要发布整个解决方案,而不需要在 MSBuild 中管理单个项目。
我能在互联网上找到的关于这个问题的唯一其他参考来自这个博客条目: https://blogs.msdn.microsoft.com/tomholl/2011/10/19/updates-to-windows-azure-msbuild-post-for-sdk-1-5/ 它暗示我可以通过指定 PackageForComputeEmulator 来解决这个问题。首先,我不知道我是否正确阅读,其次,即使我是,我也想了解构建的 CSPKG 文件在指定和不指定 PackageForComputeEmulator 的情况下有何不同。 IE。使用 PackageForComputeEmulator 将其部署到生产环境是否仍然可行且安全?
如果有人知道我为什么会收到此错误并知道如何解决它,我将不胜感激!
下面是来自 MSBuild 诊断构建的吐出,它给出了错误:
Target "Build" skipped. Previously built successfully.
Target "CorePublish" in file "C:\tfs\azure\2.8\Microsoft.WindowsAzure.targets" from project "C:\tfs\Product\WebService.Cloud\WebService.Cloud.ccproj" (target "Publish" depends on it):
Task "Message"
CorePublish: PackageWebRole = True
Done executing task "Message".
Task "Message"
Publishing starting...
Done executing task "Message".
Task "Message"
RolePlugins is
Done executing task "Message".
Task "Message"
Importedmodules is
Done executing task "Message".
Task "Message"
Publishing to 'c:\Build\Productapp.publish\'
Done executing task "Message".
Task "MakeDir"
Creating directory "c:\Build\Productapp.publish\".
Done executing task "MakeDir".
Task "Message"
TargetServiceDefinition is c:\Build\Product\WebService.Cloud\ServiceDefinition.csdef
Done executing task "Message".
Task "Message"
TargetServiceConfiguration is c:\Build\Product\WebService.Cloud\ServiceConfiguration.cscfg
Done executing task "Message".
Task "Message"
Roles is
Done executing task "Message".
Using "CSPack" task from assembly "C:\tfs\azure\v2.8\bin\Microsoft.ServiceHosting.Tools.MSBuildTasks.dll".
Task "CSPack"
Searching for imported module RemoteAccess at C:\tfs\azure\v2.8\bin\plugins\RemoteAccess\RemoteAccess.csplugin...
Searching for imported module RemoteForwarder at C:\tfs\azure\v2.8\bin\plugins\RemoteForwarder\RemoteForwarder.csplugin...
C:\tfs\azure\2.8\Microsoft.WindowsAzure.targets(3003,5): warning : CloudServices68 : No TargetFrameworkVersion specified for role WebService. Using .NET framework v4.0 for packaging. [C:\tfs\Product\WebService.Cloud\WebService.Cloud.ccproj]
c:\Build\Product\WebService.Cloud\ServiceDefinition.csdef : error CloudServices077: Need to specify the physical directory for the virtual path 'Web/' of role WebService. [C:\tfs\Product\WebService.Cloud\WebService.Cloud.ccproj]
Done executing task "CSPack" -- FAILED.
Done building target "CorePublish" in project "WebService.Cloud.ccproj" -- FAILED.
Done Building Project "C:\tfs\Product\WebService.Cloud\WebService.Cloud.ccproj" (Publish target(s)) -- FAILED.
【问题讨论】:
标签: azure msbuild azure-sdk-.net