I have a ASP.NET MVC4 project that I publish using "IIS Web Deploy Package" from Visual Studio. In the publish settings I have selected "Release" as the Configuration, but sometimes it seems to package as the "debug" version.
In my code I have #if DEBUG-statements which are executed in my deployed code.
Every time I check the publish settings, it is set to "Release" but the compiled binaries include "DEBUG" code.
How can I find out why it does this, and how to make sure that "Publish" always creates RELEASE-builds?
Thank you
EDIT:
Yesterday I experienced the same issue again. I have made the visible "version number" in my app to be suffixed with "-DEV" whenever the binary is compiled as DEBUG to make us aware of this fact.
Took some screenshots to show what I mean:
I develop using DEBUG-configuration, and when I publish it is set to use the RELEASE-configuration:
However, this resulted in a DEBUG-build. I had to change configuration in the toolbar to make it work:
Open your configuration settings (right click "Solution" -> "Properties") and check all your projects are set to "Release"
Your publish settings is a bit different from mine but here's a screenshot:
Related
I have a web site I just took over and am wanting to get web transformations working. I have always had success with MVC projects doing this for debug and release but this ASP web pages application refuses to cooperate.
I apologize if this is a duplicate. I see a lot of questions like this but nothing has solved my issue yet.
If I press F5 and run, I get web.config settings as I expect.
If I publish my "Test" profile (debug mode) I get web.Test.Config transformations as expected.
If I publish my "Release" profile I get the same web.Test.Config transformations and NOT the release one.
Possible issues or things that may be of interest:
The web.config file expands in the solution to show the debug file. The release file is not part of this and is listed separately below.
I tried changing the compilation setting for debug to false in the main web.config. This had no effect.
In the SLN file I noticed that I have lines in the GlobalSection for postSolution that list my project GUID followed by .Debug or .Release. BOTH of these say "Debug|Any CPU" at the end. I changed the release ones to say "Release|Any CPU". I republished but VS just changed this back to Debug on me.
In Build -> Configuration Manager, I select Release as thje Active soltion configuration. In the Project contexts box, my application only has Debug available in the Configuration column drop down.
Edit: I noticed that in website.publishproj there was no section for Release. There was a PropertyGroup with configuration of Debug but that's all. Being cavalier or stupid I ignored the "do not modify this file" message and added the release section. This had no effect.
Edit: Photo pasted in. The dropdown is expanded.
The highlighted dropdown is where you would need to add the configuration back in:
When I click "Publish" in my project properties, what files are actually getting published? I spent some time yesterday searching MSDN, but didn't find a clear answer.
I assumed (perhaps incorrectly) that it was publishing the latest version in source control, so I always made sure I had my changes checked in before clicking "Publish". But now I'm highly suspicious, based on a bug that was reported, that it has been publishing the Debug configuration on my laptop. I have code that should only execute in debug mode (#if DEBUG...), and it seems to be executing that code in production.
This is my first WinForms application and first time using ClickOnce deployment. Any guidance would be greatly appreciated.
What code is getting published? Latest in source control, most
recent build on build server or from local machine?
What settings do I need to set (and where are they) to ensure that my
application is published using the Release configuration?
TIA
UPDATE(S):
Here is what I see on the Publish tab
Does the Build tab come into play at all?
The Configuration setting on the Build tab is what matters when Publishing, correct? Not the selection in the toolbar?
For ASP.NET applications, when you go to publish, there will be a configuration option under settings:
The code you have locally is what gets compiled and published through Click Once. For non ASP.NET applications, the build configuration selected in visual studio is what ultimately gets published.
For this specific case, you have "Define DEBUG constant checked". That will cause the code marked as #DEBUG to be executed. It doesn't matter what the build configuration is if that is checked.
I tried on some settings on my project.
1) Select Configuration Manager by right clicking on your Solution.
2) When i clicked publish, here is what i get in output window
3) If you want to control what files (dependencies) are included as part of deployment, this can be controlled from Application Files button on the publish tab of project properties.
Here is an image.
Hope that helps.
VS2010 c#, winforms project.
It does not build automatically when I click on debug or press f5. If I manually build the project before I debug, it compiles and changes are picked up.
My other projects all work as expected. Why doesn't it build automatically?
Right-click the Solution (not project) in the Solution Explorer and select Configuration Manager. Check if Build is turn off for the current configuration.
Check your settings in Tools->Options.
Go to the projects and Solutions area, Build and Run page.
There is a setting "On Run, when projects are out of date:" Make sure this is set to 'Always build.'
I ran into this same issue and I did the following:
Run Build Clean
Close the solution
Delete any .suo and .user settings files
Delete any .ncb files
Open the solution again
Unload the project
Reload the project
Make sure the project is set as startup again
Debug away!
You may be able to only do steps 6-9 but I don't know how to get back in that state.
Because my project was independend from other projects by using prism I had to uncheck 'Only build startup projects and dependencies on Run' in Tools->Options->Projects and Solutions->Build and Run.
When you work on a dependency
In my case, I am working on a library used by an executable.
It was necessary to say to the solution to include the dependency of the library in the executable project solution to build the executable code and the library code before launching the debugging:
Tools Menu, click on Options. Go to "Projects and Solutions/Build and Run", "On Run, when projects are out of date" needs to be on "Always build".
Right-click the Solution (not project) in the Solution Explorer and select "Project Dependencies". Check the boxes of dependencies "Lib1" and "Lib2".
Just in case someone else runs into the same problem as I did: for me it turned out to be a setting in my web.config as follows:
<httpRuntime fcnMode="Disabled" targetFramework="4.5" maxRequestLength="40960" executionTimeout="1200" requestValidationMode="2.0" />
What this guy does is he disables File Change Notification, which is used to restart the application domain when a change is detected in critical files e.g. anything in the bin or .config files. Without fcn, I would make code changes, press F5 and still see the old code, and all breakpoints would be whited out because the source was different to what IISExpress was serving up.
I had a similar situation with multiple projects in a solution in Visual Studio 2013. One of the projects that the Startup project uses was not building when I clicked the Run button. I had to right-click on the Startup project and select "Build Dependencies" and check the project that wasn't building in there.
Was scratching my head on this for a while, turns out our office's Folder Redirection configuration (e.g. My Documents to point to a Network location) did not integrate well with VS.
I am new to C# and VS 2010, and am following an online guide to creating a C# Windows Service in Visual Studio 2010.
When I try and build the application however, I don't get any files created under the /bin/release folder.
I do get files under the /bin/Debug folder.
I have tried all the build configurations e.g Active, DEBUG, Release, All but nothing changes.
I have tried closing the solution down and restarting etc.
I have also experienced this same problem on a number of other projects which have been C# console apps.
The /bin/release folder exists (as I had to create it by hand) and I have checked the output path in the properties tab to ensure the release configuration is targeted to that folder.
I asked our "C# guru" at work and he didn't have a clue. Does anyone know what could be causing this?
Most likely, you are only configuring the Release build, not actually building the project in Release mode.
Simply select "Release" mode from the drop down box in the toolbar, as shown in pic below:
or you can do the same thing from your project's Properties:
Then when you will build the project (Ctrl+Shift+B), it will build in Release mode and place the output in the folder you have configured in Project properties. (Usually this is bin/release.)
If you still don't see files in the release folder then as suggested by Gishu in the comments, check the Output Window while the build is in progress to see where the binaries are actually being created.
I witnessed the same problem.Even when I had the configuration as Release as shown above,VS will some how ignore it and as I can see from the output window,it puts it in the Debug folder.
Trick that worked for me:
1] Go to Build Tab on VS.
2] Click Configuration manager.
3] Under the drop down both at active solution configuration and the project specific configuration, select release.
4] Check the project properties just to make sure. Then build it.I the release folder the required files.
Accept the answer if it helps.
I've just started using VS2010. I've got a largish solution that migrated successfully from VS2008. I've added a console application project called "Test" to the solution. Selecting build->build solution does not compile the new project. Selecting build->build Test does build the project. In the failure case, no error is given.
Similarly, setting this project as the startup project and pressing F5 to start debugging also fails to compile.
I'm upset by this. Can anyone calm me down by telling me what I'm doing wrong?
EDIT
I don't know if this is relevant or not, but today I installed AnhkSVN 2.1.8420 (latest version).
Make sure the solution configuration is set to build your new project.
Go to Build | Configuration Manager and see if the build checkbox is set for your project
For me it was incorrect build order. Right click on the solution and click on Project Build Order.... If anything is built in the wrong order switch to tab Dependencies and set correct values. After this everything worked for me.