How to get release configuration back - xcode

I deleted all the Release configurations in Xcode and now have only Debug. Is there a way to create another release configuration? I am looking to get Xcode to look like the image below.

There's no way to directly recreate the lost Release configuration.
You have two painful options:
Create a new project and copy all of your files from your existing project to your new project.
Copy the Debug configuration in the project with the missing Release configuration. Name the copy to Release. Then update all of the Build Settings for the new Release configuration.
Option 2 can be done by clicking the + icon just below the screenshot shown in the question. Then select "Duplicate "Debug" Configuration". Give the new configuration the name of "Release". The trick now is knowing what all of the release settings need to be. Create a new dummy project using the same template you used for your actual project. Then select the project and then the Build Settings tab. Choose the "Customized" and "Levels" options. Now scan down the list to see where it shows different values for Debug and Release. Make those same changes in your actual project.
As you can see in the picture below, the Build Active Architecture Only, Debug Information Format, Enable Testability, etc. settings are different between Debug and Release.

Related

How can I copy build settings from one target to another

I'm building a project with many individual test programs in it; each test program is its own target.
There are a number of settings that each target in "Build Settings" such as several preprocessor macros, and about half a dozen libraries in the "Build Phases" tab.
Every time I create a new target, I have to manually enter those values all over again. Or I can duplicate an existing target and edit its build sources.
Neither solution is easy. Is there any way to simply copy the build settings from one target to another?
Add a configuration settings file to your project. Choose File > New > File to create a new file. The configuration setting file is in the Other section under iOS or Mac.
Put the build settings you want to copy into the configuration settings file. Select your project from the project editor and click the Info button.
Use the Configurations section to tell Xcode to use your configuration settings file. You can find more detailed information on configuration settings files in the following article:
Xcode Build Configuration Files

Debug rows missing from Code Signing and Provisioning Profile sections

The problem:
With All/Combined selected from the top menu within either the Project or the Target, this is what I see. Debug used to be listed within the Provisioning Profile and Code Signing Identity sections, but it is now missing. I can build a run on the simulator like this but when trying to deploy to a tethered testing device I get errors about provisioning profile and code signing being required.
This is not a duplicate of 'Provisioning profile' options missing from 'Code signing' Xcode 6.3 because I have All/Combined selected. It's not just that Debug is not visible in the list... it doesn't even exist anymore in the project.pbxproj file that Xcode uses to build the list.
What caused it:
I was trying to remove a profile in Xcode 7.3.1 and pressed the delete key without realizing the root debug row was selected rather than the child row which holds the profile itself. I can add a child (e.g. a release type such as Any iOS SDK) to a Release or Debug row by hovering over the parent row and clicking the +, but I can't add a new root item like Debug that way. No + is available when hovering over the Code Signing or Provisioning Profile rows. Unfortunately, while I can't remove one of these root rows with the mouse (no - button on them), I can accidentally do so with the delete key – which is what led to this broken state.
What I've tried:
Cleaning, restarting Xcode and computer, reinstalling Xcode, upgrading to Xcode 8, migrating to Swift 2.3, migrating to Swift 3, etc. I used a text editor with JSON syntax highlighting to opened multiple versions of the project.pbxproj file (some before the deletion) to see the differences. The project.pbxproj file is used to generate the menu items for the project and target. The old version is missing many new settings for the Release section found in the new version now that it has gone through several upgrade iterations with Xcode and Swift migrations. Among other concerns with that file, I wouldn't even know what was missing from the Debug section I'd be trying to add back. I could start a fresh project and copy over the Debug section from it's project.pbxproj file, but I'm convinced that manually editing that file to try to add the debug items back is a bad idea. There's probably a better option.
Question:
What's the best way to restore the missing Debug menu items?
What I would suggest is to create "manually" the new Debug configuration. You will not restore your old configuration but you will be able to set the correct configuration for the Debug configuration.
The operation is described in Adding a build configuration in Xcode but in your case you will have to duplicate the Release configuration and edit it to fit your requirements.
I also guess you will have to edit your schemes to use the correct configuration for each action (build/run/...).

How can I add a new configuration to a Qt project in Visual Studio using the Qt VS add-in?

I need to add a new configuration (additional to Debug and Release) to a Visual Studio Project that has been created with the QT Visual-Studio-add-in.
Problem is that the moc files are not automatically added to the project.
Where does the QT Visual-Studio-add-in store the configuration rules for adding a moc_file based on an existing header file?
If I generate a new configuration like Release_Special
there should be a new filter Release_Special in the project that contains the files
moc_Test1.cpp
moc_Test2.cpp
with correct exclusion rules.
I am using VS2010 and qt 4.8.3.
Thank you and best regards
M.S
Took a while, but I managed to figure it out.
You need to create a new configuration without losing any of the Qt add-in custom-added stuff. Open the Configuration Manager and create a configuration, but be sure to select Debug or Release in the "Copy settings from..." dropdown list. Let's say you named the new configuration "Debug-foo", and used the settings from the pre-existing Debug configuration.
Build the project. All necessary files will be moc'd and the outputs will appear inside the GeneratedFiles\Debug-foo directory (it will be created automatically). The build will then try to process the moc files from the Debug configuration which is clearly not what we want, so as soon as the build finishes moc'ing, you can just terminate it.
Add a new filter, named "Debug-foo" under Generated Files in the solution explorer, then Add->Existing item to that, selecting all moc_(...).cpp files from GeneratedFiles\Debug-foo that the build just created.
Last, but not least, select all the files inside the Generated Files\Debug filter, select Properties and set "Excluded from build" to true, otherwise the build will include moc_ files from both Debug and Debug-foo.
Hopefully, this will be fixed in some new version of the add-in. Maybe it is already, who knows (I encountered this problem with add-in 1.1.10).
As to the part of your question about where the rules for moc_ generation are stored;
creating the configuration as a copy of an existing one saves you the trouble of adding custom build instructions for invoking moc for every file that requires it. These are stored inside the Properties of invidual header files which need moc'ing under "Custom Build tool" if you want to check them out.

Can't switch from release to debug configuration in Visual Studio 2010

I downloaded an ASP.NET open source solution and opened it in Visual Studio 2010. VS is running as admin.
Everytime I switch the solution or a project from Active (Release) to Debug and uncheck 'Optimize code' and save, these changes don't stick. The solution or project reverts back to Active (Release).
Why is this happening?
You also have to change it in Configuration-Manager (see pictures).
I just had this exact issue. The solution ended up being:
Go to Tools ⇒ Options ⇒ Make sure "Show All Settings" in the lower left is checked.
Then, in that same window, go to Projects and Solutions ⇒ General ⇒ check "Show advanced build configurations".
I have no idea why this checkbox was suddenly unchecked for me this morning, but this worked.
This is guessing a little, but anyways:
Most likely, you are using build configurations that don't include your start up project for Debug build.
Look for the 'Manage Build Configurations' (I think, no Windows machine nearby) menu item. It will show you a list of projects with tickboxes on the right to show whether it is to be built in the build configuration.
Switch to 'Debug' in that dialog and make sure your startup project - or the project that your starting the build for - is actually included in the build.
PS It is even entirely possible that the 'misbehaving' project is actually lacking a Debug build (it might have a deviant name, like DebugConsole or something else entirely). In that case, use the Project menu to add a build configuration of the proper name for that single project. Afterwards, check (again) that said build configurations are checked in the 'solution wide' build configuration dialog.
HTH
Changing the properties of a configuration doesn't change the current build configuration. If you open project properties, change from Release to Debug and make some changes, after exiting the dialog, you will build on the same platform as before. To change the platform you're building on, there is a combo-box right above the code - use that. You should have all available configurations in the list. When you open the project preferences dialog, the current configuration will be the default one in the dialog.
I opened the csproj file in a text editor. Noticed there were two PropertyGroup sections which look like duplicates, one was Debug|AnyCPU and the second was Release|AnyCPU. I deleted the second one and the debug one showed up.
Luchian Grigore's answer explains correctly one simple misconception that could lead to this problem and aaaaaaa's answer gives another way of correcting it: there is a dialog that looks like you are selecting the configuration to build but you are actually just selecting the configuration to configure.
However neither of their ways of opening the 'Configuration Manager' actually worked for me -- I had to click on the button configuration manager at the top right of the solution Properties.
(Note that the place where you choose the configuration is called Configuration Manager, whereas the place where you manage the configurations is Properties.)

How to change Xcode build setup without modifying project files?

I would like to know if it is possible to change compile settings without modifying the xcode projects.
Example, adding -Wno-unused-parameter to CFLAGS in such way that it will be used by Xcode when building projects.
This has to work in both case: build made from xcode in GUI or from the console.
If someone asks about why, let's say that the number of projects is quite big and that you may want to alter the options only temporary.
Put the compiler settings you want to change in a configuration settings file. You can create a new one by choosing File > New > New File. The configuration settings file is in the Other group under both iOS and Mac OS X.
To tell an Xcode project to use the configuration settings file, select the project file from the project navigator to open the project editor. Select the project from the left side of the editor. Click the Info button at the top of the editor. You should see a list of build configurations in the editor. Click the disclosure triangle next to a build configuration to have it use a configuration settings file.

Resources