I'm deploying a WebJob to Azure using Visual Studio, but none of the subdirectories in the build output folder of the project are copied to Azure (as per looking in the FTP folder and by virtue of the app not executing correctly). Is there any way to get the deploy to copy all the files and folders across?
More info: the subdirectories are from a referenced project and the files do have "Copy Always" set. They do appear in the output build directory of the WebJob project
UPDATE: So it seems that at some point this was fixed and now works as expected
I hacked together an automated deployment that seems to be work so far:
Add your WebJob project as a build dependency to your website project
I deploy my WebJob to a standalone Azure Website, so the website didn't reference the project directly. I don't want the build output of the WebJob project included in the bin of the website, just the proper app_data path. If you're not worried about MSBuild compatibility, you can set the build dependency using Visual Studio. Or you can edit the website project and add a reference with the other <Reference>
tags:
<ProjectReference Include="..\PathToJobs\Jobs.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
On PostBuild, copy the WebJob bin output to the magic app_data folder
WebJobs are expected to be in app_data\jobs\[type]\[name]
, so we copy the WebJob bin to the that folder in the website project:
set webjob_dist_path=$(ProjectDir)app_data\jobs\continuous\Job
IF EXIST "%webjob_dist_path%" (
RMDIR "%webjob_dist_path" /S /Q
)
XCOPY "$(SolutionDir)Jobs\bin\$(ConfigurationName)\*" "%webjob_dist_path" /Q /E /I /Y
Tell the website to include the WebJob magic folder when it deploys
(see: How do you include additional files using VS2010 web deployment packages?)
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
<ItemGroup>
<_CustomFiles Include="app_data\jobs\**\*" />
<FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
<DestinationRelativePath>%(RelativeDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
Deploy the website using the normal Azure Publish profiles. Done!
Thank you for reporting this. It looks like a bug in the tooling. I filed a bug for it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With