从.ccproj(Azure SDK 2.9)引用运行时内容 [英] Referencing runtime content from .ccproj (Azure SDK 2.9)

查看:122
本文介绍了从.ccproj(Azure SDK 2.9)引用运行时内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个工作角色,其中包含对一些nuget程序包的引用,这些程序包将一些所需的运行时文件拖放到项目bin文件夹的构建后步骤中。



我面临的问题是这些文件没有被复制到已发布的工作人员角色中,因为工作人员角色.csproj不会对其进行跟踪



工人角色.csproj:

  ... 
<导入Project = [path-to-nupkg] \build\package.targets Condition = Exists('[[path-to-nupkg] \build\package.targets') />

package.targets复制构建后资源,因此构建后的worker角色bin文件夹包括:

  MyWorkerRole.dll 
resource.txt
资源\another_resource.txt

但是,打包用于部署的worker角色时,WorkerRole.cspkg仅包含 MyWorkerRole.dll



我尝试遵循



然后编辑您的云服务 .ccproj 并覆盖 BeforeAddRoleContent 目标,如下所示:





打包云服务项目后,可以按以下方式检查打包的内容:





根据您的要求,您可以使用构建事件并复制文件放入天蓝色云服务项目中的 AdditionalContent 文件夹中。


I have a worker role that contains a reference to a few nuget packages that drop a few needed runtime files as a post-build step to the project bin folder.

The problem I'm facing is that these files are not being copied over to the published worker role as they are not tracked by the worker role .csproj

Worker role .csproj:

...
<Import Project="[path-to-nupkg]\build\package.targets" Condition="Exists('[path-to-nupkg]\build\package.targets')" />

package.targets copy post-build resources, so after build the worker role bin folder includes:

MyWorkerRole.dll
resource.txt
Resources\another_resource.txt

However, when packaging the worker role for deployment the WorkerRole.cspkg contains only MyWorkerRole.dll.

I tried to follow Dynamically Add Content to Windows Azure Application Roles by adding the following to my .ccproj:

  <Target Name="BeforeAddRoleContent">
    <ItemGroup>
      <AzureRoleContent Include="Resources\*">
        <RoleName>MyWorkerRole</RoleName>
      </AzureRoleContent>
    </ItemGroup>
  </Target>

But the folder is not dropped and I don't get any error during packaging.

Edit: It was suggested I'll try using Role Content Folders, but the problem in my case is that the resources are coming from a Nuget package. So not available until at least build time (actually being dropped as a post-build task).

解决方案

I checked Dynamically Add Content to Windows Azure Application Roles and found the additional folder for storing files should be located within your Azure Cloud Service project as follows:

Then edit your cloud service .ccproj and override the BeforeAddRoleContent target as follows:

After package your cloud service project, you could check the packaged content as follows:

Based on your requirement, you could use build events and copy files into your AdditionalContent folder within the azure cloud service project.

这篇关于从.ccproj(Azure SDK 2.9)引用运行时内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆