Skip to content

Commit ed26b6e

Browse files
authored
Merge pull request #7350 from John-Hart/addClickOnceCore
Add quick start of ClickOnce for .NET Windows projects
2 parents 45aa647 + 7ef4f3a commit ed26b6e

17 files changed

+187
-21
lines changed

docs/deployment/building-clickonce-applications-from-the-command-line.md

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@ ms.workload:
2020
- "multiple"
2121
---
2222
# Build ClickOnce applications from the command line
23+
2324
In [!INCLUDE[vs_current_short](../code-quality/includes/vs_current_short_md.md)], you can build projects from the command line, even if they are created in the integrated development environment (IDE). In fact, you can rebuild a project created with [!INCLUDE[vs_current_short](../code-quality/includes/vs_current_short_md.md)] on another computer that has only the .NET Framework installed. This allows you to reproduce a build using an automated process, for example, in a central build lab or using advanced scripting techniques beyond the scope of building the project itself.
2425

25-
## Use MSBuild to reproduce ClickOnce application deployments
26+
## Use MSBuild to reproduce .NET Framework ClickOnce application deployments
27+
2628
When you invoke msbuild /target:publish at the command line, it tells the MSBuild system to build the project and create a [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application in the publish folder. This is equivalent to selecting the **Publish** command in the IDE.
2729

2830
This command executes *msbuild.exe*, which is on the path in the Visual Studio command-prompt environment.
@@ -35,7 +37,7 @@ In [!INCLUDE[vs_current_short](../code-quality/includes/vs_current_short_md.md)]
3537

3638
## Create and build a basic ClickOnce application with MSBuild
3739

38-
#### To create and publish a ClickOnce project
40+
### To create and publish a ClickOnce project
3941

4042
1. Open Visual Studio and create a new project.
4143

@@ -70,12 +72,26 @@ In [!INCLUDE[vs_current_short](../code-quality/includes/vs_current_short_md.md)]
7072
5. Type `msbuild /target:publish`.
7173

7274
The above steps will produce a full [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application deployment in a subfolder of your project named **Publish**. *CmdLineDemo.application* is the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] deployment manifest. The folder *CmdLineDemo_1.0.0.0* contains the files *CmdLineDemo.exe* and *CmdLineDemo.exe.manifest*, the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application manifest. *Setup.exe* is the bootstrapper, which by default is configured to install the .NET Framework. The DotNetFX folder contains the redistributables for the .NET Framework. This is the entire set of files you need to deploy your application over the Web or via UNC or CD/DVD.
73-
75+
7476
> [!NOTE]
7577
> The MSBuild system uses the **PublishDir** option to specify the location for output, for example `msbuild /t:publish /p:PublishDir="<specific location>"`.
7678
79+
::: moniker range=">=vs-2019"
80+
81+
## Build .NET ClickOnce applications from the command line
82+
83+
Building .NET ClickOnce applications from the command line is a similar experience except, you need to provide an additional property for the publish profile on the MSBuild command line. The easiest way to create a publish profile is by using Visual Studio. See [Deploy a .NET Windows application using ClickOnce](quickstart-deploy-using-clickonce-folder.md) for more information.
84+
85+
Once you have the publish profile created, you can provide the pubxml file as a property on the msbuild command line. For example:
86+
87+
```cmd
88+
msbuild /t:publish /p:PublishProfile=<pubxml file> /p:PublishDir="<specific location>"
89+
```
90+
::: moniker-end
91+
7792
## Publish properties
78-
When you publish the application in the above procedures, the following properties are inserted into your project file by the Publish Wizard. These properties directly influence how the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application is produced.
93+
94+
When you publish the application in the above procedures, the following properties are inserted into your project file by the Publish Wizard or in the publish profile file for .NET Core 3.1, or later projects. These properties directly influence how the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application is produced.
7995

8096
In *CmdLineDemo.vbproj* / *CmdLineDemo.csproj*:
8197

@@ -99,21 +115,36 @@ In [!INCLUDE[vs_current_short](../code-quality/includes/vs_current_short_md.md)]
99115
<BootstrapperEnabled>true</BootstrapperEnabled>
100116
```
101117

102-
You can override any of these properties at the command line without altering the project file itself. For example, the following will build the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application deployment without the bootstrapper:
118+
For .NET Framework projects, you can override any of these properties at the command line without altering the project file itself. For example, the following will build the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application deployment without the bootstrapper:
103119

104120
```cmd
105121
msbuild /target:publish /property:BootstrapperEnabled=false
106-
```
122+
```
123+
124+
::: moniker range=">=vs-2019"
125+
For .NET Core 3.1, or later, projects these settings are provided in the pubxml file.
107126

108127
Publishing properties are controlled in [!INCLUDE[vsprvs](../code-quality/includes/vsprvs_md.md)] from the **Publish**, **Security**, and **Signing** property pages of the **Project Designer**. Below is a description of the publishing properties, along with an indication of how each is set in the various property pages of the application designer:
109128

129+
> [!NOTE]
130+
> For .NET Windows desktop projects, these settings are now found in the Publish Wizard
131+
::: moniker-end
132+
110133
- `AssemblyOriginatorKeyFile` determines the key file used to sign your [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application manifests. This same key may also be used to assign a strong name to your assemblies. This property is set on the **Signing** page of the **Project Designer**.
134+
::: moniker range=">=vs-2019"
135+
For .NET windows applications, this setting remains in the project file
136+
::: moniker-end
111137

112138
The following properties are set on the **Security** page:
113139

114140
- **Enable ClickOnce Security Settings** determines whether [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] manifests are generated. When a project is initially created, [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] manifest generation is off by default. The wizard will automatically turn this flag on when you publish for the first time.
115141

116142
- **TargetZone** determines the level of trust to be emitted into your [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application manifest. Possible values are "Internet", "LocalIntranet", and "Custom". Internet and LocalIntranet will cause a default permission set to be emitted into your [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application manifest. LocalIntranet is the default, and it basically means full trust. Custom specifies that only the permissions explicitly specified in the base *app.manifest* file are to be emitted into the [!INCLUDE[ndptecclick](../deployment/includes/ndptecclick_md.md)] application manifest. The *app.manifest* file is a partial manifest file that contains just the trust information definitions. It is a hidden file, automatically added to your project when you configure permissions on the **Security** page.
143+
-
144+
::: moniker range=">=vs-2019"
145+
> [!NOTE]
146+
> For .NET Core 3.1, or later, Windows desktop projects, these Security settings are not supported.
147+
::: moniker-end
117148

118149
The following properties are set on the **Publish** page:
119150

@@ -134,10 +165,18 @@ msbuild /target:publish /property:BootstrapperEnabled=false
134165
- `UpdateEnabled` indicates whether the application should check for updates.
135166

136167
- `UpdateMode` specifies either Foreground updates or Background updates.
137-
168+
::: moniker range=">=vs-2019"
169+
For .NET Core 3.1, or later, projects, Background is not supported.
170+
::: moniker-end
138171
- `UpdateInterval` specifies how frequently the application should check for updates.
172+
::: moniker range=">=vs-2019"
173+
For .NET Core 3.1, or later, this setting is not supported.
174+
::: moniker-end
139175

140176
- `UpdateIntervalUnits` specifies whether the `UpdateInterval` value is in units of hours, days, or weeks.
177+
::: moniker range=">=vs-2019"
178+
For .NET Core 3.1, or later, this setting is not supported.
179+
::: moniker-end
141180

142181
- `UpdateUrl` (not shown) is the location from which the application will receive updates. If specified, this value is inserted into the application manifest.
143182

@@ -154,6 +193,7 @@ msbuild /target:publish /property:BootstrapperEnabled=false
154193
- `IsWebBootstrapper` determines whether the *setup.exe* bootstrapper works over the Web or in disk-based mode.
155194

156195
## InstallURL, SupportUrl, PublishURL, and UpdateURL
196+
157197
The following table shows the four URL options for ClickOnce deployment.
158198

159199
|URL option|Description|
@@ -164,6 +204,7 @@ msbuild /target:publish /property:BootstrapperEnabled=false
164204
|`UpdateURL`|Optional. Set this URL option if the update location is different than the `InstallURL`. For example, you could set the `PublishURL` to an FTP path and set the `UpdateURL` to a Web URL.|
165205

166206
## See also
207+
167208
- <xref:Microsoft.Build.Tasks.GenerateBootstrapper>
168209
- <xref:Microsoft.Build.Tasks.GenerateApplicationManifest>
169210
- <xref:Microsoft.Build.Tasks.GenerateDeploymentManifest>

docs/deployment/choosing-a-clickonce-update-strategy.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ ms.workload:
6767
</update>
6868
</subscription>
6969
```
70+
> [!NOTE]
71+
> For .NET 3.1 and newer applications, checking updates before the application starts is the only update option supported.
7072
7173
## Make updates required
7274
There may be occasions when you want to require users to run an updated version of your application. For example, you might make a change to an external resource such as a Web service that would prevent the earlier version of your application from working correctly. In this case, you would want to mark your update as required and prevent users from running the earlier version.
@@ -113,7 +115,7 @@ ms.workload:
113115
No prompting for trust levels will occur if you use Trusted Application Deployment. For more information, see [Trusted application deployment overview](../deployment/trusted-application-deployment-overview.md).
114116

115117
## See also
116-
\<xref:System.Deployment.Application>
118+
- <xref:System.Deployment.Application>
117119
- [ClickOnce security and deployment](../deployment/clickonce-security-and-deployment.md)
118120
- [Choose a ClickOnce deployment strategy](../deployment/choosing-a-clickonce-deployment-strategy.md)
119121
- [Secure ClickOnce applications](../deployment/securing-clickonce-applications.md)

0 commit comments

Comments
 (0)