How do I set the Active SDK in xcode using AppleScript? - applescript

I've managed to set the active target, executable and the build configuration of my project using AppleScript but I can't work out how to set the Active SDK.
Any ideas?

I found the answer. I needed to set the build setting SDKROOT to the path that points to the simulator SDK.
set SDK to "/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/"
open file templateProj
set tabReaderProj to project "MyProj"
tell tabReaderProj
set the active target to the target named "MyTarget"
set value of build setting "SDKROOT" of every build configuration of the active target to SDK
end tell

Related

Visual Studio 2019 - set Docker context to solution root with multiple projects (to match docker-compose)

I have some .Net Core projects which have reference to one project (library) in the solution.
I run them using docker-compose, and have the context set to solution root (src/) so that they all see the library.
It works well, but I can't run just a single project using VS built-in docker (as it has context set to project root, not solution).
How could I set the context settings for the project, while not breaking the docker-compose functionality?
Your VS project file has an MSBuild property named DockerfileContext. Just crack open the project file in a text editor and you'll see it defined in a <PropertyGroup>. By default, it's set to ".", meaning the same directory as the project. You can set this to whatever you'd like. For example, to set it to the project's parent directory it would be set to "..\".

How do I access a resource file in Xcode?

To access the resource file namefile from a program:
I ostensibly just need to check the box "target membership" to identify it as a resource file:
but this box is disabled.
What am I missing?
The helloworld target in your project is configured as a command-line tool (the square black icon that looks like a Terminal indicates this). Those compile to a single, standalone file thus Xcode cannot embed a resource file with it (which is why it's disabled).
You need to build a "Cocoa Application" target if you want to be able to include resource files. You can start a new project using the Cocoa Application template or manually add a target to your current project. You'll probably find it easier to start with a new project.
Add resource files to a command line tool
Add the file to the "Copy Files" section of your project's Build Phases:
Make sure to set Destination to "Resources", clear Subpath, and untick Copy only when installing.
Then whenever you build, Xcode will copy the file into your app's build directory, right next to the executable:
That's a screenshot of the ~/Library/Developer/Xcode/DerivedData/[your project]/Build/Products/Debug folder.
This method also works when you archive your app.
Note: if you want the file to be in some subfolder relative to the executable, e.g. res/images/, set the Subpath to that path.

CLI Cordova change ios build target

I added in my iOS project 3 targets (with different provisioning, different plist and specific configurations).
Target 1 --> MyApp-Info.plist
Target 2 --> MyApp-2-Info.plist
Target 3 --> MyApp-3-Info.plist
However, when I execute the command cordova build ios I can not choose the target to compile. It is always the target by default (Target 1).
In the logs of the Terminal, I have always the following line:
ProcessInfoPlistFile build/emulator/MyApp.app/Info.plist MyApp/MyApp-Info.plist
Is there a way to choose the target to compile? or a Xcode project configuration?
Use a before_build hook in combination with a shell variable to dynamically copy/rename the required .plist file to MyApp-Info.plist. Eg: BUILD_TARGET=1 cordova build ios. The before hook should then of course take BUILD_TARGET into account.

how to set target for a file/bundle in xcconfig file

As we known, we can set target membership for a certain file/bundle in right navigator of xcode.
But now I want to set target membership in a certain configuration. So how can I set target for a file/bundle in xcconfig file?
Many Thanks!
You could attach a build phase that:
runs before you copy bundles phase.
It would detect whether the config is Debug vs Release using ${CONFIGURATION}
and then copy the file into a location/name where it would then get picked up by the copy files phase.

Is it possible to set project's Output Path property from nuget powershell?

I would like to set Visual Studio project property "Output Path" from nuget powershell console. How could it be done?
I have found a blog post describing how to set some project properties, but Output Path is not included.
Furthermore, the Output Path property depends on current build configuration (Debug/Release). How can be the Output Path set for any configuration (not active at the time)?
You want to set (Get-Project).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value for example:
(Get-Project).ConfigurationManager.ActiveConfiguration.Properties.Item("OutputPath").Value = "bin\NewDebugPath"

Resources