Configuration Manager only shows Debug

2019-01-18 03:56发布

问题:

I am working in Visual Studio 2008 on an ASP.NET application, which has been deployed to a test server. I would like to make a build without debug information to place in production, but the configuration manager only shows "Debug" in the configuration dropdown for my project.

My other Visual Studio projects show "Debug", "Release", "New...", and "Edit...".

Why do I not see a release option, or the new and edit commands?

回答1:

ASP.NET web sites do not use the configuration manager to determine if debug information is included in the compile. You must set it in the web.config file. Visual Studio will never change debug to "false" for you automactially, as far as I know.

Find this section in your web.config file and change it to "false":

<!--
    Set compilation debug="true" to insert debugging
    symbols into the compiled page. Because this
    affects performance, set this value to true only
    during development.
-->

<compilation debug="true">

Visual Studio will ask you if you want it changed from false to true if you are running your web site in the IDE, but unfortunately it does not do the reverse for publishing (which seems more important to me).

If you have multiple projects in your solution, and at least one of them supports a release configuration (such as a DLL) - it will appear in the configuration drop-down list. Building with Release selected still does not affect the website, however.



回答2:

After reviewing the best answer and wrestling with this problem for a couple of hours, I ran across this answer. My solution was to add a full application: usually use an empty web site, but had the same problem of the release not displaying. I added a full application to the solution and it then allowed me to deploy my project within the solution, since adding the complete application also added the option of 'release' in the dropdown. I very much appreciate the advice, but not sure why this tool is so quirky. Thanks again for your suggestion.



回答3:

The Configuration Manager for the Solution allows you to delete either (or both) of these default build configurations (through the Edit... option you mention above). I would bet that someone deleted the Release configuration.

You can get it back by recreating it, or copy the appropriate lines from a solution you make from scratch real quick. A file diff shows the following:

Default solution file:

GlobalSection(SolutionConfigurationPlatforms) = preSolution
    Debug|Any CPU = Debug|Any CPU
    Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {EDD50911-B94E-49A4-A08B-A2E91228A04B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {EDD50911-B94E-49A4-A08B-A2E91228A04B}.Debug|Any CPU.Build.0 = Debug|Any CPU
    {EDD50911-B94E-49A4-A08B-A2E91228A04B}.Release|Any CPU.ActiveCfg = Release|Any CPU
    {EDD50911-B94E-49A4-A08B-A2E91228A04B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection

Solution after I manually deleted the Release configuration:

GlobalSection(SolutionConfigurationPlatforms) = preSolution
    Debug|Any CPU = Debug|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
    {EDD50911-B94E-49A4-A08B-A2E91228A04B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
    {EDD50911-B94E-49A4-A08B-A2E91228A04B}.Debug|Any CPU.Build.0 = Debug|Any CPU
EndGlobalSection


回答4:

the process was changed, you just need to check the 2 bottom check boxes during the settings part of the publish process, as shown in the image. in the bin folder you'll find the dlls.

hope that helps

eiran