Skip to content

Commit

Permalink
doc: Nudge users into using Sample App mode
Browse files Browse the repository at this point in the history
  • Loading branch information
roxk committed Apr 22, 2024
1 parent 48a5b99 commit 648e978
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ The VS2022 extension would automatically find the WAP project that packages your

WinRT Component preview support comes in two mode. One is "Direct" mode, another is "Sample App" mode. Direct mode means you can preview directly in-project. Sample App mode means you preview via a separate "Sample App" project.

It's suggested you use Sample App mode for reliability, however Direct mode is also supported for a quicker setup.

## Limitation
- Require building the project once before use
- Packaged apps require being deployed before use
Expand Down Expand Up @@ -121,39 +123,39 @@ Make sure to replace `$YourTargetName` with your build output name. E.g. if your

6. Viola! You have finished the setup for app project

### WinRT Component Project (Direct Mode)
### WinRT Component Project (Sample App Mode)

1. Install the [VS extension](https://marketplace.visualstudio.com/items?itemName=Roxk.winui3xamlpreview). Require VS2022 17.9+

2. On your _WinUI 3 WinRT Component project_ that uses this feature, install the nuget
2. On your WinUI 3 WinRT Component's _Sample App project_ that uses this feature, install the nuget

```
nuget install WinUI3XamlPreview
```

3. If you are using C++, add `<winrt/WinUI3XamlPreview.h` to `pch.h`. C# users can go to the next step.

4. If your project has no dependency/only project-reference dependencies, you have finished the setup. If you have any dynamic nuget/external dependencies, make sure they are copied to the output folder.
3. If you are using C++, add `<winrt/WinUI3XamlPreview.h` to `pch.h` of your _Sample App Project_. C# users can go to the next step.

For example, suppose your project is `LibA` inside `Lib` folder with `Lib.sln`. With default output directory settings, you should copy any dll dependencies to `Lib\x64\Debug\LibA` if you want to preview `LibA` in `x64|Debug` configuration.
4. On your _WinUI 3 WinRT Component project_, add `<WinUI3XPLaunchProject>$SampleAppProjectName</WinUI3XPLaunchProject>` property. Make sure you replace `$SampleAppProjectName` with the name of the sample app project. E.g. if your WinRT Component's project name is `Lib`, your sample app (test app)'s project name is `LibTest`, the correct property value is `LibTest`. If you do not want to edit project file directly, you can (1) install the nuget on your _WinUI 3 WinRT Component project_, (2) edit the property by right clicking the component project in Visual Studio -> Properties -> WinUI3XamlPreview tab -> edit Launch Project. Make sure you disable the preview to save compile time. See [Configuration](#Configuration) section for more details

5. Viola! You have finished the setup for WinRT Component proejct Direct mode.
5. Viola! You have finished the setup for WinRT Component proejct Sample App mode.

### WinRT Component Project (Sample App Mode)
### WinRT Component Project (Direct Mode)

1. Install the [VS extension](https://marketplace.visualstudio.com/items?itemName=Roxk.winui3xamlpreview). Require VS2022 17.9+

2. On your WinUI 3 WinRT Component's _Sample App project_ that uses this feature, install the nuget
2. On your _WinUI 3 WinRT Component project_ that uses this feature, install the nuget

```
nuget install WinUI3XamlPreview
```

3. If you are using C++, add `<winrt/WinUI3XamlPreview.h` to `pch.h` of your _Sample App Project_. C# users can go to the next step.
3. If you are using C++, add `<winrt/WinUI3XamlPreview.h` to `pch.h`. C# users can go to the next step.

4. On your _WinUI 3 WinRT Component project_, add `<WinUI3XPLaunchProject>$SampleAppProjectName</WinUI3XPLaunchProject>` property. Make sure you replace `$SampleAppProjectName` with the name of the sample app project. E.g. if your WinRT Component's project name is `Lib`, your sample app (test app)'s project name is `LibTest`, the correct property value is `LibTest`. If you do not want to edit project file directly, you can (1) install the nuget on your _WinUI 3 WinRT Component project_, (2) edit the property by right clicking the component project in Visual Studio -> Properties -> WinUI3XamlPreview tab -> edit Launch Project. Make sure you disable the preview to save compile time. See [Configuration](#Configuration) section for more details
4. If your project has no dependency/only project-reference dependencies, you have finished the setup. If you have any dynamic nuget/external dependencies, make sure they are copied to the output folder.

5. Viola! You have finished the setup for WinRT Component proejct Sample App mode.
For example, suppose your project is `LibA` inside `Lib` folder with `Lib.sln`. With default output directory settings, you should copy any dll dependencies to `Lib\x64\Debug\LibA` if you want to preview `LibA` in `x64|Debug` configuration.

5. Viola! You have finished the setup for WinRT Component proejct Direct mode.

## Usage

Expand Down

0 comments on commit 648e978

Please sign in to comment.