1

I am using Visual Studio 2012 to deploy a Worker Role to Azure.
I can add a file to my project and mark it as:
Build Action: Content
Copy to Output Directory: Always

When I do this, Visual Studio copies the file into my project directory and then deploys this local copy to the approot directory. I'd like the deployment phase to take files from an external location and copy that into the output directory.

Is this possible?

Note: I do this because I want to deploy files that are in source control under a different directory and I don't want to maintain a different local copy.

Gilad Gat
  • 1,338
  • 2
  • 12
  • 18

1 Answers1

2

The easiest way to do this is by adding the file as link:

  1. Right click your worker role project, choose Add > Existing Item
  2. Choose a file (this can be from a different directory) and make sure you choose Add As Link. After clicking Add As Link, the file will show up in your project with something like a shortcut icon.
    Add As Link
  3. Set the Copy to Output Directory property to Copy always for that file
  4. Package the application. If you check the cspkg, you'll see that the file is in your approot folder: AppRoot content
Sandrino Di Mattia
  • 24,394
  • 2
  • 55
  • 64
  • Great, I wasn't aware of this option. Is there a way to add an entire directory as a link? Thanks in advance! – Gilad Gat Nov 26 '12 at 11:33
  • 1
    You'll need to modify the *.csproj file for that: http://stackoverflow.com/questions/3610845/add-as-link-for-folders-in-visual-studio-projects – Sandrino Di Mattia Nov 26 '12 at 11:42