Azure (WebSite-) deployment additional dependencies

If you want to publish your (Website-) project from within Visual Studio via WebDeploy you need to watch out that all files that you actually need on the server are included in the WebDeploy package. You’ll get problems if you dynamically load Assemblies via Assembly.LoadFile or Assembly.LoadFrom. If you haven’t referenced those Dlls or VS projects directly these assemblies won’t be included in the WebDeploy package and the WebSite won’t work in Azure.

To include files that are not directly referenced in your project edit the (WebProject) *.csproj-File in the following way:

<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets. -->
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
    <ItemGroup>
      <Content Include="[path to your dll]" /> <!-- the dll that should be included in the WebDeploy-package -->
    </ItemGroup>
  </Target>

2 thoughts on “Azure (WebSite-) deployment additional dependencies

  1. Thanks for this posting. I’m struggling with this issue for a while and it’s quite frustrating because it doesn’t tell me which file is missing. I tried your suggestion, but not sure if it works. Do I suppose to see those files get copied to the bin folder after build? But I’m not seeing them there. So, I’m afraid I’m not doing it right. Here is my code:

    <!– To modify your build process, add your task inside one of the targets below and uncomment it.
    Other similar extension points exist, see Microsoft.Common.targets.

    –>

Leave a comment