Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 4fd3dec

Browse files
author
Geoffrey Goh
committed
Merge branch 'windows-support' of github.com:Microsoft/react-native-code-push into windows-support
2 parents acca84d + c7cce91 commit 4fd3dec

File tree

1 file changed

+58
-9
lines changed

1 file changed

+58
-9
lines changed

README.md

Lines changed: 58 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,8 @@ This plugin provides client-side integration for the [CodePush service](http://c
77
* [Supported Components](#supported-components)
88
* [Getting Started](#getting-started)
99
* [iOS Setup](#ios-setup)
10-
* [Plugin Installation](#plugin-installation-ios)
11-
* [RNPM](#plugin-installation-ios---rnpm)
12-
* [CocoaPods](#plugin-installation-ios---cocoapods)
13-
* ["Manual"](#plugin-installation-ios---manual)
14-
* [Plugin Configuration](#plugin-configuration-ios)
1510
* [Android Setup](#android-setup)
16-
* [Plugin Installation](#plugin-installation-android)
17-
* [RNPM](#plugin-installation-android---rnpm)
18-
* ["Manual"](#plugin-installation-android---manual)
19-
* [Plugin Configuration](#plugin-configuration-android)
11+
* [Windows Setup](#windows-setup)
2012
* [Plugin Usage](#plugin-usage)
2113
* [Releasing Updates](#releasing-updates)
2214
* [API Reference](#api-reference)
@@ -40,6 +32,7 @@ In order to ensure that your end users always have a functioning version of your
4032

4133
- iOS
4234
- Android
35+
- Windows
4336

4437
We try our best to maintain backwards compatability of our plugin with previous versions of React Native, but due to the nature of the platform, and the existence of breaking changes between releases, it is possible that you need to use a specific version of the CodePush plugin in order to support the exact version of React Native you are using. The following table outlines which CodePush plugin versions officially support the respective React Native versions:
4538

@@ -286,6 +279,62 @@ public class MainActivity extends ReactActivity {
286279
}
287280
```
288281

282+
## Windows Setup
283+
284+
Once you've acquired the CodePush plugin, you need to integrate it into the Visual Studio project of your React Native app and configure it correctly. To do this, take the following steps:
285+
286+
### Plugin Installation (Windows)
287+
288+
1. Open the Visual Studio solution located at `windows\<AppName>\<AppName>.sln` within your app
289+
290+
2. Right-click the solution node in the `Solution Explorer` window and select the `Add -> Existing Project...` menu item
291+
292+
3. Browse to the `node_modules\react-native-code-push\windows` directory, select the `CodePush.sln` file and click `OK`
293+
294+
4. Back in the `Solution Explorer`, right-click the project node that is named after your app, and select the `Add -> Reference...` menu item
295+
296+
5. Select the `Projects` tab on the left hand side, check the `CodePush` item and then click `OK`
297+
298+
### Plugin Configuration (Windows)
299+
300+
After installing the plugin, you need to configure your app to consult CodePush for the location of your JS bundle, since it will "take control" of managing the current and all future versions. To do this, update the `AppReactPage.cs` file to use CodePush via the following changes:
301+
302+
```c#
303+
...
304+
// 1. Import the CodePush namespace
305+
using CodePush.ReactNative;
306+
...
307+
class AppReactPage : ReactPage
308+
{
309+
// 2. Update the JavaScriptBundleFile property to return the
310+
// bundle URL from CodePush instead of statically from the binary
311+
public override string JavaScriptBundleFile
312+
{
313+
get
314+
{
315+
return CodePush.GetBundleUrl();
316+
}
317+
}
318+
319+
// 3. Instantiate an instance of the CodePush runtime and add it to the list of
320+
// existing packages, specifying the right deployment key. If you don't already
321+
// have it, you can run "code-push deployment ls <appName> -k" to retrieve your key.
322+
public override List<IReactPackage> Packages
323+
{
324+
get
325+
{
326+
return new List<IReactPackage>
327+
{
328+
new MainReactPackage(),
329+
...
330+
new CodePush("deployment-key-here", this)
331+
};
332+
}
333+
}
334+
...
335+
}
336+
```
337+
289338
## Plugin Usage
290339

291340
With the CodePush plugin downloaded and linked, and your app asking CodePush where to get the right JS bundle from, the only thing left is to add the necessary code to your app to control the following policies:

0 commit comments

Comments
 (0)