Confused about Release/Debug folders in Visual Stu

2019-06-17 06:31发布

问题:

I am working on ASP.Net MVC 3. When I build it in debug mode, all files go to the bin folder. But I have seen people with "Debug" & "Release" folders inside the bin folder. Why don't I have that in my bin folder?

How do I have Debug & Release folders in my bin folder? Or should I really have them?

Then I saw that there are Debug & Release folders inside \obj\ folder created when using "Deployment Wizard". What is the different between these folders and the ones under "bin" folder? Are these both same?

Please help.

回答1:

Here is a good thread for what the /obj folder is for and how it's different from the /bin folder

As for why you don't have Debug/Release folders in your /bin folder:

-Under your project properties go to the Build tab

-From the Configuration on top choose Debug or Release

-For each configuration you can set the Output Path at the bottom of the window. For Debug use bin\Debug and do the same for Release.

I'm not sure why VS doesn't do this automatically -- it did it for my other projects in the same solution.



回答2:

Release Mode

When an assembly is built in release mode, the compiler performs all available optimisations to ensure that the outputted executables and libraries execute as efficiently as possible. This mode should be used for completed and tested software that is to be released to end-users. The drawback of release mode is that whilst the generated code is usually faster and smaller, it is not accessible to debugging tools.

Debug Mode

Debug mode is used whilst developing software. When an assembly is compiled in debug mode, additional symbolic information is embedded and the code is not optimised. This means that the output of the compiler is generally larger, slower and less efficient. However, a debugger can be attached to the running program to allow the code to be stepped through whilst monitoring the values of internal variables.

Some excellent SO threads about this is here and here



回答3:

Try to do the following steps:

Step I.

  1. Right click on a web project name in a solution explorer and choose "Publish"
  2. Inside a "Pick a publish target" select "Folder"
  3. Make sure you have "bin\Release\" in a "Folder or File Share" right pan
  4. Click on "Create Profile" button in a bottom right corner of the popup
  5. In opened window click on "Rename Profile" blue link
  6. Set "Release" in a "New Profile Name" input box

Step II.

  1. Once again right click on a web project name in a solution explorer and choose "Publish"
  2. Click on "Create new profile" blue link
  3. Inside a "Pick a publish target" select "Folder"
  4. Make sure you have "bin\Debug\" in a "Folder or File Share" right pan
  5. Click on "Create Profile" button in a bottom right corner of the popup
  6. In opened window click on "Settings" blue link
  7. In an opened "Publish" popup inside a left menu choose "Settings"
  8. Set "Debug" in a "Configuration" drop down list
  9. Click on "Save" button
  10. Click on "Rename Profile" blue link
  11. Set "Debug" in a "New Profile Name" input box
  12. Click on "Save" button

As a result you will have 2 profiles for publishing that you can specify in a drop down list before publishing. You can also create as many profiles as you need.

Final Step.

Try to play with it consistently changing profiles, then clicking on a "Publish" button and checking your specified output folders:

  • bin/Debug/
  • bin/Release/

If you make everything correctly you will have specific Web.config files inside each folder.



回答4:

I think When you make a desktop application then your Debug and Release folder create in Bin folder,And in web applications debug and release folder is not in bin folder.

The difference between the debug and release folder is, Debug mode : Help you in debugging like line no etc.No optimized while Release mode : It is optimized and efficient because all debug information is removed.