简体   繁体   中英

How to restore Bin folder in an ASP.NET project

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.

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,

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM