Why does VS force my build to x64? - visual-studio

Before I build, I choose x86 (or Any CPU, too) in the Properties tab for the project.
I save these properties, and if I re-open the Properties tab it's back to x64 as the platform and target, why?

Choosing a build configuration in Properties doesn't actually change the active build configuration. It only allows you to switch between the various build configurations that are defined for your project so that you can edit the settings for each of those configurations. It's only a configuration selector.
The easiest way to change the active build configuration is using the drop-down boxes on the toolbar:
Those commands should be present in your toolbar by default. If you don't see them, follow these steps to get them back where they belong.

Make sure that your .csproj file is not readonly.
Make sure that your changing the build target, not the configuration selector.

Related

What is the source of Xcode build settings defaults?

I have two Xcode projects. Neither of them have custom ENABLE_BITCODE setting .pbxproj file. But in one of them it's set by default to YES and in another one it's set to NO.
If I enable Customized filter - it's empty in both project.
Where the settings come from?
You can see sources of particular settings by enabling Levels toggle in build settings.

VS2017- Solution Configuration won't apply changes - Does not build the selected configuration

I have a solution with one project and 3 solution configurations:
Debug
Release
Staging
When I for example choose "Release" in the quick menu toolbar to change the active solution configuration and Hit F5 I expect the solution to be compiled in Release mode, but whoooo it's still debug (Output window). Ok, let's go to the configuration settings and clear it up.
But the IDE will not apply my changes...? What's wrong here?
When I go to solution -> properties -> All Configurations I expected all my configurations to be visible that I have configured. As I have only one project, I expect "Release", "Debug" and "Staging (added by me)" to be present.
But they are all set to debug...
If you open the "Configuration Manager" via the Build entry.
It opens the same "Configuration Manager" when going the route: Right-click Solution --> Properties --> Configuration Manager.
Now you can choose the Active solution configuration for example "Release" and check if the projects configuration is also set to Release, if not change it.
Click Close and rebuild your solution. Now it should build the chosen configuration. You have to repeat these steps for every configuration: Debug|Test|Staging ...etc.
This time it will remember the settings!
When going solution- -> properties it will not, at least in my case.
(1) Make sure your solution file has a configuration set for the release mode you want.
To do this, right-click the solution in Visual Studio and choose Properties. Then use the "Configuration Manager..." button. In the dialog box that appears, for the project you want to add a configuration for, choose the drop down in the Configuration column.
(2) Right-click your project file in Visual Studio and choose Properties. Select the 'Build' tab. Make sure the 'Configuration' drop down menu has the build configuration you want to use and that you have a corresponding 'Conditional compilation symbols:' entry set that matches. See screen shot below.
(3) In your code behind file (.cs for C#). You'll should see the
#if VALIDATION
// Your code when building for VALIDATION
#elif PRODUCTION
// Your code when building for PRODUCTION
#endif
By changing the drop down at the top of the screen, each of the conditions you've coded for should be enabled/disabled (visually by shading of the text) based on the configuration selected.

xcconfigs: How to set up multiple configurations for a target

I can't tell from the Xcode UI if my target is using both the Warnings and Pods xcconfigs, or just one.
I've looked at the build log in Xcode, and a search for either xcconfig name comes up empty. How can I tell what's happening behind the scenes?
Xcode's filtered build log shows no results for either configuration file:
The projects are based on "Warnings" and the targets on "Pods". The settings still cascade from project down to target but in this example "Pods" does not apply to any project. Generally I maintain sets of xcconfig files that are best suited to "seed" project settings and separate files suitable for seeding targets.
Also note that build setting propagation occurs separate from a build. Changes to xcconfig files will immediately affect project and target settings. This is why you won't see anything in a build log about them.
Think of all settings for a target build being derived from target settings which may inherit from project settings, which inherit from system default settings. Then independently of that think of xcconfig files as a way of automatically imposing settings at either the project or target level, at a lower priority to manual edits you make in the settings UI.
See? Simple. ;)
Yes, they're inherited.
There's two ways to tell:
Approach a): Look at the build settings for the target.
To find out if Warnings.xcconfig is set up for the RACTest target below:
We select the RACTest target from the dropdown my mouse was over (where that "Select a project or target" hover text is appearing in the first screenshot):
And under the Combined view of All build settings, you'll see the xcconfig listed on the right side:
You'll also see the xcconfig listed under the top-level project target, if you select Build Settings with the project selected:
Approach b): Search the build logs for a property set in your xcconfig.

How to delete user-defined build settings in Xcode 4.3.1

I have created several user-defined build settings in Xcode 4.3.1. I no longer need these settings and want to delete them, but there doesn't seem to be a way to delete them!
I am aware that these are stored in the project settings (project.pbxproj) file located within the xcodeproj file. But I don't want to edit these in a text editor as there are all sorts of repetitions and guids which I don't understand.
Any suggestions on how I can do this within Xcode? (or have they forgotten to add a "delete" button)
Just figured this out myself: you need to make sure you're at the right scope to be able to delete the setting. If you defined the setting at the project scope, no amount of key-bashing will remove it if you're looking at the target-scope. Remember, targets inherit settings from project scope. That last bit is what I tripped over :)
Try selecting a user-defined setting that you created then hit "Delete" button on your keyboard. That works for me when I encountered the same problem.
On Xcode 6:
Select the row and hit Fn + Delete.
Follow the steps below:
Select Project
Tap on the Info tab
Select Configurations
Select Configuration to remove
Press the Delete button on the keyboard
Removing User-Defined build settings depends on where those settings have been created.
Lets assume that you've created one already and named it as PROJECT_SETTING. In order to check your PROJECT related User-Defined settings, you have to select your project first on the project and targets list, then you should see something like this:
Here you can see only PROJECT related settings, and here you have the
only ability edit/delete PROJECT_SETTING.
Besides that if you set up a TARGET, so can add new User-Defined settings there, that only affects that TARGET scope.
You can edit/delete TARGET_SETTING_1 and TARGET_SETTING_2 here, but
PROJECT_SETTING is read-only, as it is inherited from your
PROJECT settings.
Here you will notice that your TARGET contains your PROJECT User-Defined settings and also your TARGET related User-Defined settings marked as bold letters. This helps you to know which setting can be edited on this level.
You won't be able to delete your settings here if that was created under PROJECT scope, and also editing a PROJECT related User-Defined settings will result a newly created settings that affects only the selected TARGET.
Also if you prefer more visibility on Build Settings, you can select Levels view instead of Combined view, so you should see it more separated:
Select one of them and press keyboard's delete button.
There's a caveat to these answers: If you're using a Build Configuration File (.xcconfig) it doesn't seem possible to delete the user-defined settings generated from these files directly on either the project or target level in the "Build Settings" GUI. You'll have to delete the flag and its value from the configuration file and rebuild the project. If you're using multiple build configuration files that use the same flag, you'll have to delete them from each file.
Although settings that come from these configuration files are displayed in the User Defined build settings section (just like any other user-defined flag that one would create from the GUI), they are not written to the .xcodeproj file like the settings that one adds from the GUI are (which probably prevents them from being able to be deleted from the GUI). They are also not displayed in bold text like these GUI-added settings are.

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.)

Resources