5

My site works fine, but when I [re]publish it via Build > Publish Web Site, it says that it's in Debug configuration. I would think it should be something else, like "Release," but that option is not available to me in the dropdown below the Tools menu - "Debug" is the only available option. Note: I do have debug set to false in web.config.

If I click on the configuration dropdown, it does have a "Configuration Manager" menu item, but that simply brings up the eponymous dialog, and the project "record" in the grid on that dialog has the same thing - a Configuration dropdown with "Debug" as its only option.

Platform is set to "Any CPU" (this is an ASP.NET site/app), the Build checkbox is checked, the Deploy is not (and won't let me check it, presumably because Configuration == Debug).

So how can I change my project/site to Release mode?

UPDATE

Okay, this seems rather bizarre. Based on Arma's comment/suggestion, I searched for the *.sln file; I found .sln in C:\Users\Clay\Visual Studio 2012\Projects\, but C:\ is where the project is actually saved.

Yet the *.sln file there does have today's date for last modification. Why is the .sln in one place, the project in another, yet files in both places are being updated?

UPDATE 2

At Arma's request/behest, here is a scream shot of the Solution Explorer (most of it, anyway):

enter image description here

UPDATE 3

It seems as if Visual Studio has scattered my project files in two different places - it's preferred/default location (C:\Users\Clay\Visual Studio 2012\Projects\) as well as in the spot where I specified the project to be created (a folder below the root that I created). If this is why I'm having this odd problem (Debug is my only configuration option), I need to know how to rectify it, and how to avoid it in the future. ASAP (tomorrow) I will bountify this question. If somebody answers it prior to them, I will generate an after-the-fact bounty and award it to them.

4 Answers 4

5

The Build configuration in the Publish Profile doesn't matter for web site projects, it only matters for Web Application projects. See http://msdn.microsoft.com/en-us/library/dd465337.aspx

"This setting doesn’t have any effect for web site projects. For a web site project you’ll see Debug listed as a build configuration, but that has no effect when the web site project is compiled dynamically. For more information, see Web Application Projects versus Web Site Projects in Visual Studio."

0
3
+50

It shouldn't matter that your solution and project files are in different locations. To fix that just move your solution file and edit its XML by updating paths to project files.

I think the answer you're looking for is a means to publish a Release configuration where the web.config is deployed with debug="false". Is that correct?

Have you tried adding a new Release configuration in Configuration Manager? This should generate a Web.Release.config transform file beneath your Web.config file (if not then right-click Web.config and choose Add Config Transforms). Then look at using transformation syntax (http://msdn.microsoft.com/en-us/library/dd465326.aspx) to define exactly what you want your deployed Release version of Web.config to contain. Your Web.Release.config will look something like this:

<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
    <system.web>
        <compilation debug="false" xdt:Transform="Replace" />
    </system.web>
</configuration>

P.S. I like the concept of a "scream shot" :)

5
  • It's good to know that it shouldn't matter, but is it the norm? How did such a thing happen? How would I prevent it in the future? I don't like the default location of projects (where VS wants to put them). I always want them in a top-level folder with a name corresponding to the project, such as "C:\GordianKnothead", not "C:\Program Files\Microsoft\Visual Studio Projects\bla\bla\bla" or whatever. Sep 5, 2013 at 15:22
  • The answer to the question in the second paragraph is, "Yes" Sep 5, 2013 at 15:22
  • Well, my site seems to be working fine having been released with debug configuration. Is it a problem? Is my OCD manifesting itself in wanting it to be "Release" and should I just "don't worry, be happy"? BTW, yes, every time I get to write "scream shot" I think of Edvard Munch's most famous painting. Sep 5, 2013 at 15:25
  • Right-clicking Web.config in my asp.net project at work shows "Add Config Transforms" but grayed out. Is this because there are already "Web.Debug.config" and "Web.Release.config" below it? Sep 5, 2013 at 15:38
  • The configuration names are just labels. Doesn't matter if it's called Debug if the configuration has release settings. Not ideal though if you're the OCD kind ;) As for Config Transforms, try deleting them and adding a Release configuration (if you haven't already). Then make my changes in the Web.Release.config. That should get you where you wanted. Sep 6, 2013 at 15:43
3

You can enable this from options to show the Solution in Visual Studio Solution Explorer

Tools -> Options -> Projects & Solutions ->General-> check the checkbox "Always show solution" 

Then right click the solutionFile in SolutionExplorer -> Choose OpenFolder in windows Explorer to Open the exact solution file. Make sure to keep a backup file of your solution file before making any change. Now Edit the solution file, look for below sections, and add as the after section.

Before:

GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
                EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {97A7F977-AF9D-494E-AB65-32CCB9A06F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {97A7F977-AF9D-494E-AB65-32CCB9A06F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {8C498C19-A5BB-41A2-BA03-B2DC384EB605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {8C498C19-A5BB-41A2-BA03-B2DC384EB605}.Debug|Any CPU.Build.0 = Debug|Any CPU

    EndGlobalSection

After:

GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {97A7F977-AF9D-494E-AB65-32CCB9A06F30}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {97A7F977-AF9D-494E-AB65-32CCB9A06F30}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {97A7F977-AF9D-494E-AB65-32CCB9A06F30}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {97A7F977-AF9D-494E-AB65-32CCB9A06F30}.Release|Any CPU.Build.0 = Release|Any CPU
        {8C498C19-A5BB-41A2-BA03-B2DC384EB605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {8C498C19-A5BB-41A2-BA03-B2DC384EB605}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {8C498C19-A5BB-41A2-BA03-B2DC384EB605}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {8C498C19-A5BB-41A2-BA03-B2DC384EB605}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection

Here "97A7F977-AF9D-494E-AB65-32CCB9A06F30" and "8C498C19-A5BB-41A2-BA03-B2DC384EB605" is the ProjectIds, this could be different in your case.In this case i have only 2 Projects in my solution. you have to do this for every projects in this solution. Hope this helps.

1
  • 1
    Surely this is not the canonical way of doing it? I imagine it probably works, but it seems like in the same way as you can "depress the gas pedal" in your car by opening the hood and holding a screwdriver against the linkage. Sep 5, 2013 at 15:20
2

I'm not sure but in your project folder open Web.config and change debug="true" to debug="false" and then save and upload it. Does it work?! If it doesn't work write your error here to more suggestions. (I'm so sorry for my bad English speaking) . . . . I forgot it! Open your projects .sln file and the double click on the "My Project" on the Solution Explorer and the select compile on the left and the on the top select your configuration mode

5
  • You seem to have two separate suggestions here. Could you list them more clearly as two suggestions, and less as a stream of consciousness like "I forgot!"
    – verbose
    Sep 2, 2013 at 20:40
  • As I mentioned, I do have debug set to false in web.config. I see no .sln file anywhere in my project, neither in solution explorer nor in Windows explorer. Sep 2, 2013 at 21:37
  • Can you send a screenshot of your project files to me? I mean send a screenshot of your solution explorer.
    – Arma
    Sep 2, 2013 at 22:36
  • Ok. Test it: Double click on "Web.config" and change debug="true" to debug="false". If it doesn't work in Project menu click on YorProjectName Properties... and Then on the left side click on compile and then change your configuration setting. Does it work?! Can you find these?
    – Arma
    Sep 3, 2013 at 9:55
  • Debug remains set to False in web.config; selecting Debug | <projName> Properties, there is no "Compile" there; there are only: References, Build, Accessibility, Start Options, MSBuild Options, and Silverlight Applications Sep 4, 2013 at 1:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.