Search code examples
visual-studioazurepublish

Azure Website Deployment from Visual Studio - How to deploy just a single missing assembly?


I have an Azure website built using Visual Studio and .NET (C#). I noticed that for whatever reason, an assembly was not getting put into the /Bin folder when BS built the app. So I copied the file to my Bin folder. However, when I deploy, the file I manually copied to the /Bin folder isn't getting included in the deployment. Or at least I don't think it is.

Is there a way I can tell VS to include this file when I publish? Or is there a way I can tell VS to republish the entire app, instead of just files it detects are changed?


Solution

  • For managed assemblies, setting CopyLocal to true for the reference fixes it.

    If it's an unmanaged binary, then you can follow following approach:

    • Look for AfterBuild on the .csproj file, and include a command to copy the binary to bin directory.

      <Message Text="Copy $(SolutionDir)Lib\binary.dll to $(OutDir)binary.dll" Importance="high"/>
      <Copy SourceFiles="$(SolutionDir)Lib\binary.dll" DestinationFiles="$(OutDir)binary.dll" />
      
    • Include the binary on the .csproj along with other files. Setting visible to false will hide the file on Solution Explorer.

      <Content Include="Bin\binary.dll">
        <Visible>false</Visible>
      </Content>