संपादित करें

इसके माध्यम से साझा किया गया


Building UWP C# apps for Windows

Important

Visual Studio App Center is scheduled for retirement on March 31, 2025. While you can continue to use Visual Studio App Center until it is fully retired, there are several recommended alternatives that you may consider migrating to.

Learn more about support timelines and alternatives.

To start building your first UWP app, do these steps:

  1. Connect to your repository service account (GitHub, Bitbucket, VSTS, Azure DevOps).
  2. Select a repository and a branch where your app lives.
  3. Set up your first build.

1. Linking your repository

First you must connect to your repository service account. Once your account is connected, select the repository where your UWP project is located. To set up a build for a repository, you need admin and pull permission for it.

2. Selecting a branch

After selecting a repository, select the branch you want to build. By default, all the active branches will be listed.

3. Setting up your first build

Before your first build, the UWP project needs to be configured.

3.1. Select solution

First, make sure the right solution is selected. The available solutions in your repository will populate if they're located within the range of analysis.

Note

All projects referenced in the solution will be built, make sure those are only for UWP and in C#.
For best performance, the analysis is limited to two directory levels including the root of your repository.

3.2. Configuration

The available build configurations will populate from your solution. By default it's Debug and Release. Select which configuration should be built.

3.3. Platforms

Select the platforms your UWP app should be built for.

3.4. Increment version number

When enabled, the version number of your app automatically increments for each build. The version format is {Major}.{Minor}.{Build}.{Revision}, we only increase the Build number. The change happens pre build and won't be committed to your repository.

3.5. Simulator build

Simulator builds can only be ran on simulators and can't be installed on the device, however the builds complete faster than device builds. If your build isn't a simulator build, you need to upload code signing files in the next step.

3.6. Code signing

Uploading your own certificate is optional. In case you don't provide one, App Center will automatically generate a temporary certificate and sign the build for you. This certificate is unique for each build.

3.7. NuGet restore

If the NuGet.Config file is checked into the repository, and sitting next to the .sln or at the level of your repository, App Center restores your private NuGet feeds when they're added as shown in the example below. Credentials can be added safely by using environment variables:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="MyGet" value="https://www.myget.org/F/MyUsername/api/v2/index.json" />
    <add key="MyAuthNuget" value="https://nuget.example.com/v2/index.json" />
  </packageSources>
  <activePackageSource>
    <add key="All" value="(Aggregate source)" />
  </activePackageSource>
  <packageSourceCredentials>
    <MyAuthNuget>
      <add key="Username" value="%USER_VARIABLE%" />
      <add key="ClearTextPassword" value="%PASSWORD_VARIABLE%" />
    </MyAuthNuget>
  </packageSourceCredentials>
</configuration>

If you have complex configurations and need more information, refer to Configuring NuGet behavior.

3.8. Distribute to a distribution group

You can configure each successful build from a branch to be distributed to a previously created distribution group. You can add a new distribution group from within the Distribute section. There's always a default distribution group called "Collaborators" that includes all the users who have access to the app.

Once you save the configuration, a new build will be kicked off automatically.

4. Supported versions and requirements

The minimum Windows 10 Build supported to build UWP apps is 16299. Our build machines are running Visual Studio 2019.