* update xcsync docs as a global dotnet tool now

* add instructions for installing

* consolidate

* add toggle for cli vs vscode ext

* address reviews

* Update docs/macios/xcsync.md

Co-authored-by: Michael Cummings (MSFT) <mcumming@microsoft.com>

* review

* Update docs/macios/xcsync.md

Co-authored-by: Michael Cummings (MSFT) <mcumming@microsoft.com>

* update target path in options docs too

* Edits.

---------

Co-authored-by: Michael Cummings (MSFT) <mcumming@microsoft.com>
Co-authored-by: David Britch <davidbritch@users.noreply.github.com>
This commit is contained in:
Haritha Mohan 2024-11-11 02:36:06 -08:00 коммит произвёл GitHub
Родитель 22e1f8a3e8
Коммит 8239128ac2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 85 добавлений и 44 удалений

Просмотреть файл

@ -923,7 +923,7 @@
href: ios/device-provisioning/manual-provisioning.md
- name: Universal links
href: macios/universal-links.md
- name: Xcode sync
- name: Syncing with Xcode
href: macios/xcsync.md
- name: Mac Catalyst
items:
@ -945,7 +945,7 @@
href: macios/system-special-folders.md
- name: Universal links
href: macios/universal-links.md
- name: Xcode sync
- name: Syncing with Xcode
href: macios/xcsync.md
- name: Configure multi-targeting
href: platform-integration/configure-multi-targeting.md

Просмотреть файл

@ -1,15 +1,16 @@
---
title: Xcode sync
description: Learn how to use Xcsync, to provide .NET developers with improved support for editing Apple specific files.
title: xcsync
description: Learn how to use xcsync, to provide .NET developers with improved support for editing Apple specific files.
author: haritha-mohan
ms.author: harithamohan
ms.date: 08/05/2024
ms.date: 10/30/2024
monikerRange: ">=net-maui-9.0"
no-loc: [ "xcsync" ]
---
# Xcode sync (xcsync)
Xcode sync (xcsync) is a tool that enables developers to leverage Xcode for managing Apple specific files with .NET projects. The tool generates a temporary Xcode project from a .NET project and synchronizes changes to the Xcode files back to the .NET project.
# Syncing with Xcode
xcsync is a .NET tool that enables developers to leverage Xcode for managing Apple specific files with .NET projects. The tool generates a temporary Xcode project from a .NET project and synchronizes changes to the Xcode files back to the .NET project.
Supported file types include:
@ -20,68 +21,108 @@ Supported file types include:
The tool has two commands: `generate` and `sync`. Use `generate` to create an Xcode project from a .NET project and `sync` to bring changes in the Xcode project back to the .NET project.
<!-- markdownlint-disable MD025 -->
# [Visual Studio Code](#tab/visual-studio-code)
<!-- markdownlint-enable MD025 -->
## Installation
Install .NET xcsync globally with the following command:
```dotnetcli
dotnet tool install -g dotnet-xcsync
```
## Usage
1. The [.NET MAUI extension](https://aka.ms/mauidevkit-marketplace) provides support for xcsync. Ensure you have the latest version. The xcsync commands in the .NET MAUI extension are only available when using Visual Studio Code on macOS.
2. Open the command palette (<kbd>Cmd + Shift + P</kbd>) and search for the `.NET MAUI: xcsync - Generate an Xcode project` and `.NET MAUI: xcsync - Sync from an Xcode project` commands.
## Troubleshooting
To see details on errors related to xcsync, navigate to the **Output** window (<kbd>CMD + Shift + u </kbd>) and select **.NET MAUI - xcsync** in the dropdown. If you are facing issues, please [report an issue](#provide-feedback).
## Provide feedback
Please check existing [Known Issues](https://github.com/dotnet/xcsync/issues) before filing a new issue or suggestion.
<!-- markdownlint-disable MD025 -->
# [CLI](#tab/cli)
<!-- markdownlint-enable MD025 -->
## Installation
Install .NET xcsync globally with the following command:
```dotnetcli
dotnet tool install -g dotnet-xcsync
```
## Synopsis
The following examples show the syntax for the `generate` and `sync` commands.
### xcsync-generate
```dotnetcli
dotnet build /t:xcsync-generate
/p:xcSyncProjectFile=<PROJECT>
/p:xcSyncXcodeFolder=<TARGET_XCODE_DIRECTORY>
/p:xcSyncTargetFrameworkMoniker=<FRAMEWORK>
/p:xcSyncVerbosity=<LEVEL>
xcsync generate [-p|--project <PROJECT>]
[-tfm|--target-framework-moniker <FRAMEWORK>]
[-t|--target <TARGET_XCODE_DIRECTORY>] [-f|--force]
[-o|--open] [-v|--verbosity <LEVEL>]
[-d|--dotnet-path <PATH>]
xcsync sync [-p|--project <PROJECT>]
[-tfm|--target-framework-moniker <FRAMEWORK>]
[-t|--target <TARGET_XCODE_DIRECTORY>] [-v|--verbosity <LEVEL>]
xcsync -h|--help
```
### xcsync-sync
```dotnetcli
dotnet build /t:xcsync-sync
/p:xcSyncProjectFile=<PROJECT>
/p:xcSyncXcodeFolder=<TARGET_XCODE_DIRECTORY>
/p:xcSyncTargetFrameworkMoniker=<FRAMEWORK>
/p:xcSyncVerbosity=<LEVEL>
```
### Arguments
- **`/p:xcSyncProjectFile=<PROJECT>`**
The project file to build. Supported project types are .NET MAUI projects or any .NET project that targets a supported platform (iOS, tvOS, macOS, MacCatalyst).
### Options
The following options allow you to change the default behavior of the tool:
- **`-p|--project <PROJECT>`**
- **`/p:xcSyncTargetFrameworkMoniker=<FRAMEWORK>`**
The project file to build. Supported project types are .NET MAUI projects or any .NET project that targets a supported platform (iOS, tvOS, macOS, MacCatalyst).
- **`-tfm|--target-framework-moniker <FRAMEWORK>`**
Invoke the tool for a specific framework. The framework must be defined in the project file. Examples: `net9.0-ios`, `net9.0-maccatalyst`. **Required** if the .NET project supports multiple target frameworks (for example, a standard MAUI project). If a single platform project, the default value will be the single target framework specified in the project file.
Invoke the tool for a specific framework. The framework must be defined in the project file. Examples: `net9.0-ios`, `net9.0-maccatalyst`. **Required** if the .NET project supports multiple target frameworks (for example, a multi-targeted .NET MAUI project). If a single platform project, the default value will be the single target framework specified in the project file.
- **`-t|--target <TARGET_XCODE_DIRECTORY>`**
- **`/p:xcSyncXcodeFolder=<TARGET_XCODE_DIRECTORY>`**
The directory in which to place the generated Xcode project. Default value is `(*_$(IntermediateOutputPath)_/xcsync*)`.
- **`-f|--force`**
The directory in which to place the generated Xcode project. The default path is *./obj/xcode*.
Forces the overwrite of an existing Xcode project. Default value is `False`.
- **`-o|--open`**
- **`/p:xcSyncVerbosity=<LEVEL>`**
Opens the generated project in Xcode. Default value is `False`.
- **`-v|--verbosity <LEVEL>`**
Sets the verbosity level of the command. Allowed values are `Detailed`, `Diagnostic`, `Minimal`, `Normal`, `Quiet`. The default value is `Normal`.
Sets the verbosity level of the command. Allowed values are `Detailed`, `Diagnostic`, `Minimal`, `Normal`, `Quiet`. Default value is `Normal`.
- **`-d|--dotnet-path <PATH>`**
### Examples
Path to .NET SDK. Default value is path from parent process if it is `dotnet`, otherwise falls back to `dotnet` on PATH.
- **`-h|--help`**
Shows help and usage information
## Examples
- Generate and open an Xcode project for a .NET MAUI project that uses the project file in the current directory, which supports the `net9.0-ios` [TFM](/dotnet/standard/frameworks):
```dotnetcli
dotnet build /t:xcsync-generate /p:xcSyncTargetFrameworkMoniker=net9.0-ios
xcsync generate -tfm net9.0-ios
```
- Generate and open an Xcode project for a .NET MAUI project that supports the `net9.0-ios` [TFM](/dotnet/standard/frameworks):
```dotnetcli
dotnet build /t:xcsync-generate /p:xcSyncProjectFile=path/to/maui.csproj /p:xcSyncTargetFrameworkMoniker=net9.0-ios
xcsync generate -p path/to/maui.csproj -tfm net9.0-ios
```
- Sync changes from a generated Xcode project in the default location (*./obj/Xcode*) back to a .NET MAUI project that supports the `net9.0-ios` [TFM](/dotnet/standard/frameworks):
- Sync changes from a generated Xcode project in the default location (*_$(IntermediateOutputPath)_/xcsync*) back to a .NET MAUI project that supports the `net9.0-ios` [TFM](/dotnet/standard/frameworks):
```dotnetcli
dotnet build /t:xcsync-sync /p:xcSyncProjectFile=path/to/maui.csproj /p:xcSyncTargetFrameworkMoniker=net9.0-ios
xcsync sync -p path/to/maui.csproj -tfm net9.0-ios
```
---
## More information
xcsync is open-source. For more information or to file an issue, please visit <https://github.com/dotnet/xcsync>.