Configuration Manager only shows Debug - visual-studio

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?

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.

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.

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

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

Related

Not choosing the right platform by Visual Studio

I'm working with Visual Studio 2012 Premium Update 5.
I have a solution with x86 platform activated and on my computer there is a Platform environment variable with value BWS.
When I right click on solution and select rebuild I get the following error in all of my projects:
The OutputPath property is not set for project
'MyCompany.Data.Environment.Model.csproj'. Please check to make sure
that you have specified a valid combination of Configuration and
Platform for this project. Configuration='Debug' Platform='BWS'.
This error may also appear if some other project is trying to follow a
project-to-project reference to this project, this project has been
unloaded or is not included in the solution, and the referencing
project does not build using the same or an equivalent Configuration
or Platform.
Why it is getting Platform='BWS' if I have selected 'x86'?
NOTE: searching on Internet I have found that this Platform=BWS is something specific for HP machines (I'm having this problem on HP workstation). This environment variable is not said by any of my Visual Studio projects, it has been said by HP on all of their computers. Take a look here and here.
But, if I use msbuild /p:Configuration=Release /p:Platform=x86 it compiles without any problem.
I have created another project with Visual Studio and this project compiles perfectly on Visual Studio.
In first's project solution I have found this:
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug MySoftware|Any CPU = Debug MySoftware|Any CPU
Debug MySoftware|x64 = Debug MySoftware|x64
Debug MySoftware|x86 = Debug MySoftware|x86
Debug Plugins|Any CPU = Debug Plugins|Any CPU
Debug Plugins|x64 = Debug Plugins|x64
Debug Plugins|x86 = Debug Plugins|x86
Debug Remote Plugins|Any CPU = Debug Remote Plugins|Any CPU
Debug Remote Plugins|x64 = Debug Remote Plugins|x64
Debug Remote Plugins|x86 = Debug Remote Plugins|x86
Debug SDK|Any CPU = Debug SDK|Any CPU
Debug SDK|x64 = Debug SDK|x64
Debug SDK|x86 = Debug SDK|x86
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
There are a lot of configurations. I have remove them but it still doesn't compile and showing the same error.
If I remove Platform=BWS environment variable, I don't see that error about Platform=BWS but I get another one telling that it doesn't find another solution's project dlls. It seems that Visual Studio doesn't compile any dependant project and only search for their dlls.
I think the problem is that Visual Studio doesn't pass to msbuild platform value (like #stijn has said).

Visual Studio warning: “Some of the properties associated with the solution could not be read”

Yesterday I made some changes for my solution such as renamed it and moved to a different location in TFS 2013 server.
Today I received the message
“One or more projects in the solution were not loaded correctly.
Please see the Output Window for details”
when opening a solution in Visual Studio:
Unfortunatley the details in the output window were not very helpful:
Some of the properties associated with the solution could not be read
I only have one project in the solution. Here is the solution file.
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GenericIVR", "OutboundGeneric\GenericIVR.csproj", "{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}"
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 1
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://tfs01:8080/tfs/software%20repository
SccProjectUniqueName0 = OutboundGeneric\\GenericIVR.csproj
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
AnotherDebug|Any CPU = AnotherDebug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.AnotherDebug|Any CPU.ActiveCfg = AnotherDebug|Any CPU
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.AnotherDebug|Any CPU.Build.0 = AnotherDebug|Any CPU
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Edit your GlobalSection(TeamFoundationVersionControl) = preSolution section with the following lines after "SccTeamFoundationServer":
SccLocalPath0 = .
SccProjectUniqueName1 = OutboundGeneric\\GenericIVR.csproj
SccProjectName1 = GenericIVR
SccLocalPath1 = GenericIVR
Don't ask me why that SccLocalPath0 should be present, but I have seen it in the older VS version too.
Following on from the suggestion above, I found that in my case the solution file had an incorrect number of SccNumberOfProjects configured. Somehow I had managed to get 15, a quick count and correction of the number of projects contained in the solution fixed it for me.
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 13
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
I also had a similar problem, in my case I had two GlobalSection(TeamFoundationVersionControl) = preSolution sections in my sln. I manually removed the content of the section (and deleted the 2nd entirely). Then I opened my solution and got an error 'solution not under source control'. Then I Added it to source control again via Add to Source Control. Then I saved everything and the section was restored.
I'm not exactly sure what caused this for me, but my solution was to delete everything between "Global" and "EndGlobal" and then open the solution. It rebuilt the solution file and works fine. Comparing the old and new, it seems probable that there was extraneous info within GlobalSection(SolutionConfigurationPlatforms) = preSolution
Before:
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|Default = Debug|Default
Release|Any CPU = Release|Any CPU
Release|Default = Release|Default
EndGlobalSection
After
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
Similar answer to anhoppe, but with a couple of differences.
I had a situation where a merge of a .sln file had resulted in 2 separate GlobalSection(TeamFoundationVersionControl) sections, the first had the incorrect number of projects in it, the second had the correct number.
I initially deleted the first GlobalSection(TeamFoundationVersionControl) and left the second one in place. This didn't work and I still saw the error...
Some of the properties associated with the solution could not be
read
So, I undid this change and then deleted just the second GlobalSection(TeamFoundationVersionControl), saved and re-opened the solution. This did the job and I just had to re-add the couple of projects that had been taken out of source control.
Just fixed the issue in VS2015 by editing the .sln file...
Every entry in
GlobalSection(ProjectConfigurationPlatforms) = postSolution sections
needed to have both entries for each configuration
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3B46A2C8-B9FF-48F3-978D-CF27B1EC917D}.Debug|Any CPU.Build.0 = Debug|Any CPU
When
solution could not be read
occurred, only the ActiveCfg entry was present. Added the Build.0 entry where it was omitted and
solution could not be read
was corrected.
Even i faced same issue but found that SccNumberOfProjects = 11 where i have only 10 projects in my solution, so i have changed 10 insteadof 11, now it is working fine.
I use VS2017.
I tried to delete everything between "Global" and "EndGlobal" as the answer in this post. It works.
Then I find the reason why it works: it makes VS delete all "Release" configuration in all .csproj.
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
I guess the problem in my case was caused by using "Release" configuration to build then went back to “Debug” configuration to code & debug.

Visual Studio solution file - what does the "Build.0" mean?

I'm looking at my Visual Studio .sln file as I'm customising build configurations (the reason why is a long story involving projects that won't load in VS2012).
Does anyone know what the Build.0 part of the build config section means? Does it mean that this project is ticked to be built under this build configuration?
Also, what does the ActiveCfg relate to?
{CFHHHA78-C688-40B3-B53A-20C963A6F138}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CFHHHA78-C688-40B3-B53A-20C963A6F138}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CFHHHA78-C688-40B3-B53A-20C963A6F138}.Debug|Mixed Platforms.ActiveCfg = Debug|AnyCPU
{CFHHHA78-C688-40B3-B53A-20C963A6F138}.Debug|x86.ActiveCfg = Debug|Any CPU
Any links to .sln file walkthroughs would also be welcome. As always, the MSDN .sln file explanation is a little cryptic and doesn't seem to fully explain this part of the sln file.
Yes, your hunch was right. It does mean that the project has its Build option ticked to build under the build configuration. I just tested this by opening the solution in one instance of Visual Studio and the .sln file in the text editor (open with) of another Visual Studio instance. If you change the configuration options in the first and save all, you will see the appropriate changes in the second.
I'm not 100% sure (haven't found any source to confirm my guess), but I believe the .ActiveCfg and Build.0 in the entries withing the GlobalSection(ProjectConfigurationPlatforms) section are being used as described below.
{3759D495-6929-4371-92B1-E0C0F5215051}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3759D495-6929-4371-92B1-E0C0F5215051}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3759D495-6929-4371-92B1-E0C0F5215051}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
{3759D495-6929-4371-92B1-E0C0F5215051}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
If I set the solution's Configuration property to "Debug" and set the Platform property to "Any CPU", according to the above entries, the project will build, because of the Build.0 line, and the Configuration and Platform properties will be set to "Debug" and "Any CPU" for building that project, since that is what the ActiveCfg line says to send to the project when building using that combination of Configuration and Platform properties.
If I set the Configuration property to "Debug" and set Platform to "Mixed Platforms", the solution will build the project, but it will still use "Debug|Any CPU" for the Configuration and Platform properties, since that is what the ActiveCfg line says to send.

Visual Studios sln file SolutionProperties or Performance?

I am working on a team project using Mercurial as our version control. Recently, I noticed that after a pull and merging the latest changes into my branch, the following change appears in the .sln file.
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
changes to:
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
There are no noticable differences, everything seems to build OK, but I am unsure if this change will cause any potential problems. We are also confused as to why this change happened.
I believe HideSolutionNode is true by default, until you add a second project to the solution (at least with vs2010 and probably 2012.) HasPerformanceSessions is probably due to someone trying to run the profiler on the code. Neither of these should impact the compilation of your solution.

Missing configuration setting in configuration manager

I often create custom build configurations in my solution's Configuration Manager. When I include previously created projects into the solution they do not automatically include these new configurations. The only way I have found to back fill these projects with the appropriate configuration settings is to manually edit the project file.
Is there a way to force all projects in a solution to all use the same set of Configuration Manager configurations?
I found that removing all the configurations and than adding them back in again fixes all the projects in the solution
The VS2010 "Export Template Wizard" extension will work for this situation. You will have to create a project and set up all of your configuruations, files, etc. Then export it as a Template. When you start a new project you can select your new template and the settings in the Configuration Manager will carry over. I created a simple test project and this worked. This will not account for any projects that you have already created.
This blog post by DevGuy has a walk through with pictures on the process.
I just had the same issue and here is how I fixed it.
First close Visual Studio and find the project guid from new projects. Your can do this by looking in your .csproj file. Then open the solution file in a text editor like Notepad++.
In the solution file, find the section called GlobalSection(ProjectConfigurationPlatforms) = postSolution.
Each of your projects will have a listing there with the configuration. You will notice that your new projects likely already have settings for your configurations, BUT they will be set to DEBUG or RELEASE as shown in the example below.
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.ActiveCfg = Debug|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.Build.0 = Debug|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.ActiveCfg = Debug|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.Build.0 = Debug|Any CPU
To fix this, change the Debug|Any CPU to be instead your configuration. So in my example above my settings will become the following:
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.ActiveCfg = Staging|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Staging|Any CPU.Build.0 = Staging|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.ActiveCfg = Live|Any CPU
{2E6B7D61-640E-4878-BE6D-7CD705AB9A6A}.Live|Any CPU.Build.0 = Live|Any CPU
Save the changes and then relaunch Visual Studio and open your solution.
You could write a Visual Studio macro that does this for you. Bind it to a menu button and you have a one-click way to add these configurations to a project.

Resources