forked from dotnet/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConsoleApplicationBase.xml
251 lines (203 loc) · 16.5 KB
/
ConsoleApplicationBase.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
<Type Name="ConsoleApplicationBase" FullName="Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase">
<TypeSignature Language="C#" Value="public class ConsoleApplicationBase : Microsoft.VisualBasic.ApplicationServices.ApplicationBase" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi ConsoleApplicationBase extends Microsoft.VisualBasic.ApplicationServices.ApplicationBase" />
<TypeSignature Language="DocId" Value="T:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase" />
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>Microsoft.VisualBasic.ApplicationServices.ApplicationBase</BaseTypeName>
</Base>
<Interfaces />
<Docs>
<summary>Provides properties, methods, and events related to the current application.</summary>
<remarks>
<format type="text/markdown"><]
]]></format>
</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ConsoleApplicationBase ();" />
<MemberSignature Language="ILAsm" Value=".method public specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.#ctor" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase" /> class.</summary>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="CommandLineArgs">
<MemberSignature Language="C#" Value="public System.Collections.ObjectModel.ReadOnlyCollection<string> CommandLineArgs { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<string> CommandLineArgs" />
<MemberSignature Language="DocId" Value="P:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.CommandLineArgs" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.String></ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a collection containing the command-line arguments as strings for the current application.</summary>
<value>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see langword="String" />, containing the command-line arguments as strings for the current application.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
The `My.Application.CommandLineArgs` property provides read-only access to the current application's command-line arguments for applications that are not ClickOnce deployed.
For a single-instance application, the `My.Application.CommandLineArgs` property returns the command-line arguments for the first instance of an application. To access the arguments for subsequent attempts to start a single-instance application, you must handle the <xref:Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.StartupNextInstance> event and examine the <xref:Microsoft.VisualBasic.ApplicationServices.StartupEventArgs.CommandLine%2A> property of the <xref:Microsoft.VisualBasic.ApplicationServices.StartupEventArgs> argument.
> [!NOTE]
> The `My.Application.CommandLineArgs` property returns only the command-line arguments. This is different from the behavior of the <xref:System.Environment.CommandLine%2A> property, which returns the application name in addition to the arguments.
> [!NOTE]
> In an application that is ClickOnce deployed, use the <xref:System.Deployment.Application.ApplicationDeployment.ActivationUri%2A> property of the `My.Application.Deployment` object to get the command-line arguments. For more information, see <xref:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.Deployment%2A>.
The following table lists examples of tasks involving the `My.Application.CommandLineArgs` property.
|To|See|
|-|-|
|Check the command-line arguments of subsequent attempts to start a single-instance application|<xref:Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.StartupNextInstance>|
## Availability by Project Type
|Project type|Available|
|-|-|
|Windows Application|**Yes**|
|Class Library|No|
|Console Application|**Yes**|
|Windows Control Library|No|
|Web Control Library|No|
|Windows Service|**Yes**|
|Web Site|No|
## Examples
This example uses the `My.Application.CommandLineArgs` property to examine the application's command-line arguments. If an argument is found that starts with `/input=`, the rest of that argument is displayed.
[!code-vb[VbVbalrMyApplication#3](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrMyApplication/VB/Form1.vb#3)]
]]></format>
</remarks>
<altCompliant cref="P:System.Environment.CommandLine" />
<permission cref="T:System.Security.Permissions.EnvironmentPermission">Controls the ability to access the PATH environment variable. Associated enumeration: <see cref="F:System.Security.Permissions.EnvironmentPermissionAccess.Read" />.</permission>
</Docs>
</Member>
<Member MemberName="Deployment">
<MemberSignature Language="C#" Value="public System.Deployment.Application.ApplicationDeployment Deployment { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Deployment.Application.ApplicationDeployment Deployment" />
<MemberSignature Language="DocId" Value="P:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.Deployment" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Deployment.Application.ApplicationDeployment</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets the current application's ClickOnce deployment object, which provides support for updating the current deployment programmatically and support for the on-demand download of files.</summary>
<value>Returns the <see cref="T:System.Deployment.Application.ApplicationDeployment" /> object for the application's ClickOnce deployment.</value>
<remarks>
<format type="text/markdown">< and [Publishing ClickOnce Applications](http://msdn.microsoft.com/library/eb6dfe79-f54c-4331-8e36-073688e70973).
Confirm that the <xref:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.IsNetworkDeployed%2A> property is `True` before you access the `My.Application.Deployment` property. Otherwise, if the application is not deployed using ClickOnce, reading the `My.Application.Deployment` property results in an <xref:System.Deployment.Application.InvalidDeploymentException> exception. For more information on deploying a ClickOnce application, see [How to: Publish a ClickOnce Application using the Publish Wizard](http://msdn.microsoft.com/library/2e4aa67c-4445-4f7b-9e03-9acb95829127).
For more information on using the `My.Application.Deployment` property, see [Overview of the Visual Basic Application Model](~/docs/visual-basic/developing-apps/development-with-my/overview-of-the-visual-basic-application-model.md).
## Availability by Project Type
|Project type|Available|
|-|-|
|Windows Forms Application|**Yes**|
|Class Library|No|
|Console Application|**Yes**|
|Windows Forms Control Library|No|
|Web Control Library|No|
|Windows Service|**Yes**|
|Web Site|No|
## Examples
This example downloads and installs the update after checking that the application is network-deployed. The <xref:System.Deployment.Application.ApplicationDeployment.Update%2A> method does not update the application unless it is out of date. The application has to restart to use the update.
[!code-vb[VbVbalrMyApplication#4](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrMyApplication/VB/Form1.vb#4)]
Only applications that are ClickOnce deployed can be updated using the `My.Application.Deployment` object. For more information on deploying a ClickOnce application, see [How to: Publish a ClickOnce Application using the Publish Wizard](http://msdn.microsoft.com/library/2e4aa67c-4445-4f7b-9e03-9acb95829127).
]]></format>
</remarks>
<exception cref="T:System.Deployment.Application.InvalidDeploymentException">The application is not deployed as a ClickOnce application.</exception>
<permission cref="T:System.Security.Permissions.FileIOPermission">Controls the ability to access files and folders. Associated enumeration: <see cref="F:System.Security.Permissions.PermissionState.Unrestricted" />.</permission>
</Docs>
</Member>
<Member MemberName="InternalCommandLine">
<MemberSignature Language="C#" Value="protected System.Collections.ObjectModel.ReadOnlyCollection<string> InternalCommandLine { set; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Collections.ObjectModel.ReadOnlyCollection`1<string> InternalCommandLine" />
<MemberSignature Language="DocId" Value="P:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.InternalCommandLine" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName>System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Collections.ObjectModel.ReadOnlyCollection<System.String></ReturnType>
</ReturnValue>
<Docs>
<summary>Sets the values to use as the current application's command-line arguments.</summary>
<value>A <see cref="T:System.Collections.ObjectModel.ReadOnlyCollection`1" /> of <see langword="String" />, containing the strings to use as the command-line arguments for the current application.</value>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
This method allows you to set the internal value of the command-line arguments used by the <xref:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase> class. This property determines what the <xref:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.CommandLineArgs%2A> property returns. If you do not set this property, or you set this property to `Nothing`, the <xref:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.CommandLineArgs%2A> property obtains the command-line arguments from the <xref:System.Environment.CommandLine%2A> property.
]]></format>
</remarks>
</Docs>
</Member>
<Member MemberName="IsNetworkDeployed">
<MemberSignature Language="C#" Value="public bool IsNetworkDeployed { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsNetworkDeployed" />
<MemberSignature Language="DocId" Value="P:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.IsNetworkDeployed" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.VisualBasic</AssemblyName>
<AssemblyVersion>10.0.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>Gets a <see langword="Boolean" /> that represents whether the application was deployed from a network using ClickOnce.</summary>
<value>A <see langword="Boolean" /> that represents whether the application was deployed from a network. The value is <see langword="True" /> if the current application was deployed from a network; otherwise the value is <see langword="False" />.</value>
<remarks>
<format type="text/markdown"><.
You should confirm that this property is `True` before you access the <xref:Microsoft.VisualBasic.ApplicationServices.ConsoleApplicationBase.Deployment%2A> property. Otherwise, if the application is not deployed from a network using ClickOnce, reading the `My.Application.Deployment` property results in an <xref:System.Deployment.Application.InvalidDeploymentException> exception.
For more information on configuring ClickOnce, see [Publishing ClickOnce Applications](http://msdn.microsoft.com/library/eb6dfe79-f54c-4331-8e36-073688e70973). For more information on deploying a ClickOnce application, see [How to: Publish a ClickOnce Application using the Publish Wizard](http://msdn.microsoft.com/library/2e4aa67c-4445-4f7b-9e03-9acb95829127).
For more information on using the `My.Application.IsNetworkDeployed` property, see [Overview of the Visual Basic Application Model](~/docs/visual-basic/developing-apps/development-with-my/overview-of-the-visual-basic-application-model.md).
## Availability by Project Type
|Project type|Available|
|-|-|
|Windows Forms Application|**Yes**|
|Class Library|No|
|Console Application|**Yes**|
|Windows Forms Control Library|No|
|Web Control Library|No|
|Windows Service|**Yes**|
|Web Site|No|
## Examples
This example downloads and installs the update after checking that the application is deployed from a network. The <xref:System.Deployment.Application.ApplicationDeployment.Update%2A> method does not update the application unless it is out of date. The application has to restart to use the update.
[!code-vb[VbVbalrMyApplication#4](~/samples/snippets/visualbasic/VS_Snippets_VBCSharp/VbVbalrMyApplication/VB/Form1.vb#4)]
Only applications that are ClickOnce-deployed can be updated using the `My.Application.Deployment` object. For more information on deploying a ClickOnce application, see [How to: Publish a ClickOnce Application using the Publish Wizard](http://msdn.microsoft.com/library/2e4aa67c-4445-4f7b-9e03-9acb95829127).
]]></format>
</remarks>
<permission cref="T:System.Security.Permissions.FileIOPermission">Controls the ability to access files and folders. Associated enumeration: <see cref="F:System.Security.Permissions.PermissionState.Unrestricted" />.</permission>
</Docs>
</Member>
</Members>
</Type>