locked
How to restore Bin folder in an ASP.NET project RRS feed

  • Question

  • User641445359 posted

    Scenario:

    • Create an ASP.NET Web Site(Razor v3)
    • Build the project
    • The 'packages' and 'Bin' folder get populated
    • Delete 'packages' and 'Bin' folder
    • Build the project
    • 'packages' gets populated, but 'Bin' does not (it is missing).
    • Website does not work any more

    Question: How can I restore the deleted 'Bin' folder ? I want to exclude it from source control and if I'm cloning the project clean, I won't be able to run it without restoring the missing 'Bin' folder.

    Sunday, March 25, 2018 11:46 PM

All replies

  • User283571144 posted

    Hi aex,

    Question: How can I restore the deleted 'Bin' folder ? I want to exclude it from source control and if I'm cloning the project clean, I won't be able to run it without restoring the missing 'Bin' folder.

    As far as I know, when I install a NuGet package, such as Microsoft.AspNet.Razor, into an ASP.NET web pages application then the bin folder is created.

    Getting the binaries into the bin folder is part of the build process and it is not done by NuGet. NuGet can be used to restore the files into the packages folder but will not do anything with your bin folder when restoring.

    For building and package restore to work it looks like you need to keep the bin folder and any .refresh files. You can remove the other binaries from your version control system.

    System.Web.Razor.dll.refresh

    Its content:

    ..\packages\Microsoft.AspNet.Razor.3.2.4\lib\net45\System.Web.Razor.dll

    So if you want to restore the bin folder's package, you need keep the refresh dll in the bin folder.

    If the refresh dll is exists, the VS will auto copy the dll into the bin folder.

    Best Regards,

    Brando

    Monday, March 26, 2018 3:01 AM
  • User641445359 posted

    Hey, Thanks, that actually works! If I keep the .refresh files for the .dll's then the DLL's do get restored on build.

    The remaining issue now is that this doesn't seem to work for the Bin\roslyn\ folder. If I delete binaries in this folder (leaving everything else) then still nothing gets restored and the app still won't build\run (csc is missing).

    Any idea how to fix this - how to have the compiler also get restored on build ?

    PS: How do you guys deal with this scenario ? Do you just check in all the binaries in the version control ?

    EDIT: Needed to remove the compiler packages from my project. Works when build + deploy locally, issues might come when deploying remotely. Dunno what impact this will have on my deploy but I guess I will find out eventually :).

    Monday, March 26, 2018 4:39 AM
  • User283571144 posted

    Hi aex,

    As far as I know, we couldn't restore the roslyn folder.

     I suggest you could try to create a new web site with the same version and copy the  roslyn folder inside your web site project.

    Best Regards,

    Brando

    Tuesday, March 27, 2018 8:09 AM