0

There are two folders in the solution folder(but not added to solution) which I want to copy to approot of that worker role. These folder contains dlls and other files which I do not want to include in the solution and mark them as "Content".

I'm using Azure 2.4 SDK. I read about content element on msdn and tried to use content element to achieve this. Something like below:

<Contents>
  <Content destination="\EnterpriseLibraries_5_0">
    <SourceDirectory path="..\..\EnterpriseLibraries\EnterpriseLibraries_5_0\" />     
  </Content>
  <Content destination="\EnterpriseLibraries_6_0">
    <SourceDirectory path="..\..\EnterpriseLibraries\EnterpriseLibraries_6_0" />
  </Content>
</Contents>    

However it fails in finding source directory each time. I'm stuck in creating relative path for these folders.

As a second approach, I xcopied these folder contents as post build activity into $Outdir. But postbuild events do not have effect on what's get copied to approot.

Please suggest way of achieving this external content copy to approot using relative path.

Update: Adding physical path to source directory in the content element works beautifully. However I'm unable to create relative path, can't figure out how "relative path" is "relative" to which folder.

Back to relative path issues: It seems like base path for the relative keeps changing. It starts from \\bin\debug sometimes, if I create relative path taking this base path during next build somehow \ becomes base path.

I keep getting error likes during build for path:

Try 1: ServiceDefinition.csdef(0,0): error CloudServices089: Cannot find the source directory 'D:\a\b\c\d\aa\aa\bin\Debug....\ExternalLib\EnterpriseLibraries_5_0\' in role WCFWorker.

Try 2: ServiceDefinition.csdef(0,0): error CloudServices089: Cannot find the source directory 'D:\a\b\c\d\aa\aa........\ExternalLib\EnterpriseLibraries_5_0\' in role WCFWorker.

seesharpconcepts
  • 180
  • 2
  • 4
  • 13

1 Answers1

0

A solution to get a full path at build time is possible using a hack:

In your ccproj file, you can set environment variables using the SetEnvironmentVariableTask defined in https://stackoverflow.com/a/20014410/413672 as shown below:

<Target Name="BeforePackageComputeService">
  <SetEnvironmentVariableTask Name="CCPROJ_DIR" Value="$(MSBuildThisFileDirectory)" />
</Target>

Finally, reference the %CCPROJ_DIR% variable in the path attribute of your SourceDirectory xml element.

Community
  • 1
  • 1
minghan
  • 1,013
  • 7
  • 12