Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Alex Gill 26 posts 61 karma points
    Nov 28, 2013 @ 15:13
    Alex Gill
    0

    When building my project, three necessary Courier .dlls get deleted

    The following three files are repeatedly being deleted when I rebuild my ASP.NET MVC project:

    • /bin/FluentNHibernate.dll
    • /bin/Umbraco.Courier.Providers.dll
    • /bin/Umbraco.Licensing.dll

    Specifically, in order to reproduce this I have to run (debug) the project, then hit 'Rebuild' - at this point, the files are deleted. If I undelete them and hit rebuild again, they stay. It's only once I have run and then rebuilt that the files disappear.

    I am going to try reinstalling Courier, but if that fails, does anyone else have any ideas?

    Thanks

  • Alex Gill 26 posts 61 karma points
    Nov 28, 2013 @ 15:27
    Alex Gill
    0

    This is due to Visual Studio cleaning out the .dlls when performing a Rebuild (as you might expect). I fixed the issue by setting read-only permissions on the files - however, these files should not reside in the /bin/ folder in the first place, as that is supposed to be the output directory for a solution. They should be relocated to a folder such as /lib/ that is not affected by VS.

  • Laurence Gillian 600 posts 1219 karma points
    Nov 28, 2013 @ 18:47
    Laurence Gillian
    0

    It's a good idea when using Umbraco and Visual Studio to use common build output directory.

    E.g don't use /bin, use ../output/

    This gives separation between the binaries used in your own project, and the binaries inside the Umbraco /Bin.
    This separation solves the 'rebuild' issues which causes random DLL's to be removed.

    In each visual studio project, update your Output Path, to: (via the properties dialogue)

    ../output/(Configuration)/

    ../output/Debug/
    ../output/Release/

    * This translates as, go up a directory to the parent of the project, and then place the build output inside 'output' \ 'configuration' *

    One each build you will need to copy the contents of this folder into the project containing the Umbraco web application. These will need to be copied from the corresponding 'Configuration' folder to ensure the DLL's are correct. This folder will also include any references from NuGet.

    Remember this /output/ directory should be ignored in your source control system of choice.

    You could use a post build event, or if you are doing it properly, you should add the event into your *.csproj file using MSBuild. The following snippet is from my build events I use in all of our projects. This should be a post build event.

    <!-- MSBuild event to copy files out of a common build directory into your Umbraco project -->
    <ItemGroup>
      <ProjectsOutput Include="..\output\$(Configuration)\*.*" />
    </ItemGroup>
    
    <Copy SourceFiles="@(ProjectsOutput)" DestinationFolder="$(MSBuildProjectDirectory)\bin\%(RecursiveDir)" />
    

    Simple! :-)

  • Umbraco 137 posts 294 karma points
    Nov 28, 2013 @ 23:58
    Umbraco
    0

    You can try this trick: add a folder named _bin_deployableAssemblies to your Web Application project (all files in that folder will be copied into the bin folder when you (re)build the project).

     

  • Alex Gill 26 posts 61 karma points
    Nov 29, 2013 @ 10:56
    Alex Gill
    0

    Thanks for your responses.

    Laurence, that sounds like a good way to do it, although I would prefer to have a /lib/ folder and use a post-build script to copy the .DLLs to the /bin/ folder. Do you see any downside with this approach?

  • Laurence Gillian 600 posts 1219 karma points
    Nov 29, 2013 @ 13:16
    Laurence Gillian
    0

    Nope no downside at all! The post build script, just gets injected into the post build msbuild event anyway! ;)

    I like to use a directory outside of the project folder, so if you have a multi-project solution, you can use one common directory.

    Remember this directory does not need to be included in source control :)

Please Sign in or register to post replies

Write your reply to:

Draft