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>