Skip to content

Commit f9344b0

Browse files
authored
Merge pull request #2957 from MicrosoftDocs/master
6/23/2020 AM Publish
2 parents 493fd87 + 1aff48a commit f9344b0

3 files changed

Lines changed: 159 additions & 7 deletions

File tree

‎docs/code-quality/using-rule-sets-to-specify-the-cpp-rules-to-run.md‎

Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,145 @@ The following example shows a basic rule set file that you can use as a starting
102102
```
103103

104104
::: moniker-end
105+
106+
## Ruleset schema
107+
108+
The following ruleset schema describes the XML schema of a ruleset file. The ruleset schema is stored in `%VSINSTALLDIR%\Team Tools\Static Analysis Tools\Schemas\RuleSet.xsd`. You can use it to author your own rulesets programmatically or to validate whether your custom rulesets adhere to the correct format. For more information, see [How to: Create an XML document based on an XSD schema](https://docs.microsoft.com/visualstudio/xml-tools/how-to-create-an-xml-document-based-on-an-xsd-schema?view=vs-2019).
109+
110+
```xml
111+
<?xml version="1.0" encoding="utf-8"?>
112+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
113+
114+
<xs:annotation>
115+
<xs:documentation xml:lang="en">
116+
Visual Studio Code Analysis Rule Set Schema Definition Language.
117+
Copyright (c) Microsoft Corporation. All rights reserved.
118+
</xs:documentation>
119+
</xs:annotation>
120+
121+
<!-- Every time this file changes, be sure to change the Validate method for the corresponding object in the code -->
122+
123+
<xs:element name="RuleSet" type="TRuleSet">
124+
</xs:element>
125+
126+
<xs:complexType name="TLocalization">
127+
<xs:all>
128+
<xs:element name="Name" type="TName" minOccurs="0" maxOccurs="1" />
129+
<xs:element name="Description" type="TDescription" minOccurs="0" maxOccurs="1" />
130+
</xs:all>
131+
<xs:attribute name="ResourceAssembly" type="TNonEmptyString" use="required" />
132+
<xs:attribute name="ResourceBaseName" type="TNonEmptyString" use="required" />
133+
</xs:complexType>
134+
135+
<xs:complexType name="TRuleHintPaths">
136+
<xs:sequence>
137+
<xs:element name="Path" type="TNonEmptyString" minOccurs="0" maxOccurs="unbounded" />
138+
</xs:sequence>
139+
</xs:complexType>
140+
141+
<xs:complexType name="TName">
142+
<xs:attribute name="Resource" type="TNonEmptyString" use="required" />
143+
</xs:complexType>
144+
145+
<xs:complexType name="TDescription">
146+
<xs:attribute name="Resource" type="TNonEmptyString" use="required" />
147+
</xs:complexType>
148+
149+
<xs:complexType name="TInclude">
150+
<xs:attribute name="Path" type="TNonEmptyString" use="required" />
151+
<xs:attribute name="Action" type="TIncludeAction" use="required" />
152+
</xs:complexType>
153+
154+
<xs:complexType name="TIncludeAll">
155+
<xs:attribute name="Action" type="TIncludeAllAction" use="required" />
156+
</xs:complexType>
157+
158+
<xs:complexType name="TRule">
159+
<xs:attribute name="Id" type="TNonEmptyString" use="required" />
160+
<xs:attribute name="Action" type="TRuleAction" use="required" />
161+
</xs:complexType>
162+
163+
<xs:complexType name="TRules">
164+
<xs:sequence>
165+
<xs:element name="Rule" type="TRule" minOccurs="0" maxOccurs="unbounded" />
166+
</xs:sequence>
167+
<xs:attribute name="AnalyzerId" type="TNonEmptyString" use="required" />
168+
<xs:attribute name="RuleNamespace" type="TNonEmptyString" use="required" />
169+
</xs:complexType>
170+
171+
<xs:complexType name="TRuleSet">
172+
<xs:sequence minOccurs="0" maxOccurs="1">
173+
<xs:element name="Localization" type="TLocalization" minOccurs="0" maxOccurs="1" />
174+
<xs:element name="RuleHintPaths" type="TRuleHintPaths" minOccurs="0" maxOccurs="1" />
175+
<xs:element name="IncludeAll" type="TIncludeAll" minOccurs="0" maxOccurs="1" />
176+
<xs:choice minOccurs="0" maxOccurs="unbounded">
177+
<xs:element name="Include" type="TInclude" minOccurs="0" maxOccurs="unbounded" />
178+
<xs:element name="Rules" type="TRules" minOccurs="0" maxOccurs="unbounded">
179+
<xs:unique name="UniqueRuleName">
180+
<xs:selector xpath="Rule" />
181+
<xs:field xpath="@Id" />
182+
</xs:unique>
183+
</xs:element>
184+
</xs:choice>
185+
</xs:sequence>
186+
<xs:attribute name="Name" type="TNonEmptyString" use="required" />
187+
<xs:attribute name="Description" type="xs:string" use="optional" />
188+
<xs:attribute name="ToolsVersion" type="TNonEmptyString" use="required" />
189+
</xs:complexType>
190+
191+
<xs:simpleType name="TRuleAction">
192+
<xs:restriction base="xs:string">
193+
<xs:enumeration value="Error"/>
194+
<xs:enumeration value="Warning"/>
195+
<xs:enumeration value="Info"/>
196+
<xs:enumeration value="Hidden"/>
197+
<xs:enumeration value="None"/>
198+
</xs:restriction>
199+
</xs:simpleType>
200+
201+
<xs:simpleType name="TIncludeAction">
202+
<xs:restriction base="xs:string">
203+
<xs:enumeration value="Error"/>
204+
<xs:enumeration value="Warning"/>
205+
<xs:enumeration value="Info"/>
206+
<xs:enumeration value="Hidden"/>
207+
<xs:enumeration value="None"/>
208+
<xs:enumeration value="Default"/>
209+
</xs:restriction>
210+
</xs:simpleType>
211+
212+
<xs:simpleType name="TIncludeAllAction">
213+
<xs:restriction base="xs:string">
214+
<xs:enumeration value="Error"/>
215+
<xs:enumeration value="Warning"/>
216+
<xs:enumeration value="Info"/>
217+
<xs:enumeration value="Hidden"/>
218+
</xs:restriction>
219+
</xs:simpleType>
220+
221+
<xs:simpleType name="TNonEmptyString">
222+
<xs:restriction base="xs:string">
223+
<xs:minLength value="1" />
224+
</xs:restriction>
225+
</xs:simpleType>
226+
227+
</xs:schema>
228+
229+
```
230+
231+
Schema element details:
232+
233+
- TLocalization: Localization information including name of the ruleset file, description of the ruleset file, name of the resource assembly containing the localized resource, and base name of the localized resource.
234+
- TRuleHintPaths: File paths used as hints to search for ruleset files.
235+
- TName: Name of the current ruleset file.
236+
- TDescription: Description of the current ruleset file.
237+
- TInclude: Path to an included ruleset with rule action.
238+
- TIncludeAll: Rule action for all rules.
239+
- TRule: Rule ID with rule action.
240+
- TRules: Collection of one or more rules.
241+
- TRuleSet: Ruleset file format consisting of localization information, rule hint paths, include all information, include information, rules information, name, description, and tools version information.
242+
- TRuleAction: Enumeration describing a rule action such as an error, warning, info, hidden, or none.
243+
- TIncludeAction: Enumeration describing a rule action such as an error, warning, info, hidden, none, or default.
244+
- TIncludeAllAction: Enumeration describing a rule action such as an error, warning, info, or hidden.
245+
246+
To see an example of a ruleset, see [To create a rule set in a text editor](#to-create-a-rule-set-in-a-text-editor), or any of the default rulesets stored in `%VSINSTALLDIR%\Team Tools\Static Analysis Tools\Rule Sets`.

‎docs/linux/cmake-linux-project.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "Create and configure a Linux CMake project in Visual Studio"
33
description: "How to create, configure, edit, and compile a Linux CMake project in Visual Studio"
4-
ms.date: "05/03/2020"
4+
ms.date: "06/22/2020"
55
ms.assetid: f8707b32-f90d-494d-ae0b-1d44425fdc25
66
---
77
# Create and configure a Linux CMake project
@@ -114,8 +114,14 @@ After you select a target, CMake runs automatically on the Linux system to gener
114114

115115
![Generate CMake cache on Linux](media/cmake-linux-1.png "Generate the CMake cache on Linux")
116116

117+
### Intellisense
118+
117119
To provide IntelliSense support for headers on remote Linux systems, Visual Studio automatically copies them from the Linux machine to a directory on your local Windows machine. For more information, see [IntelliSense for remote headers](configure-a-linux-project.md#remote_intellisense).
118120

121+
### Locale
122+
123+
For more information, see [Linux target locale](configure-a-linux-project.md#locale).
124+
119125
## <a name="debug_cmake_project"></a> Debug the CMake project
120126

121127
To debug your code on the specified target system, set a breakpoint. Select the CMake target as the startup item in the toolbar menu next to the project setting. Then choose **&#x23f5; Start** on the toolbar, or press **F5**.

‎docs/linux/configure-a-linux-project.md‎

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Configure a C++ Linux project in Visual Studio"
3-
ms.date: "06/11/2019"
3+
ms.date: "06/22/2020"
44
ms.assetid: 4d7c6adf-54b9-4b23-bd23-5de0c825b768
55
---
66
# Configure a Linux project
@@ -27,7 +27,7 @@ You can configure a Linux project to target a physical Linux machine, a virtual
2727

2828
## General settings
2929

30-
To view configuration options, select the **Project > Properties** menu, or right click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
30+
To view configuration options, select the **Project > Properties** menu, or right-click on the project in **Solution Explorer** and select **Properties** from the context menu. The **General** settings appear.
3131

3232
![General configuration](media/settings_general.png)
3333

@@ -37,7 +37,7 @@ For more information about the settings in the property pages, see [Linux Projec
3737

3838
## Remote settings
3939

40-
To change settings pertaining to the remote Linux computer, configure the remote settings that appear under [General](prop-pages/general-linux.md).
40+
To change settings related to the remote Linux computer, configure the remote settings that appear under [General](prop-pages/general-linux.md).
4141

4242
- To specify a remote target Linux computer, use the **Remote Build Machine** entry. This will allow you to select one of the connections created previously. To create a new entry, see the [Connecting to Your Remote Linux Computer](connect-to-your-remote-linux-computer.md) section.
4343

@@ -66,17 +66,17 @@ To change settings pertaining to the remote Linux computer, configure the remote
6666

6767
::: moniker range="vs-2019"
6868

69-
This section does not apply when targeting WSL.
69+
This section doesn't apply when targeting WSL.
7070

7171
::: moniker-end
7272

7373
When building on remote systems, the source files on your development PC are copied to the Linux computer and compiled there. By default, all sources in the Visual Studio project are copied to the locations set in the settings above. However, additional sources can also be added to the list, or copying sources can be turned off entirely, which is the default for a Makefile project.
7474

75-
- **Sources to copy** determines which sources are copied to the remote computer. By default, the **\@(SourcesToCopyRemotely)** defaults to all source code files in the project, but does not include any asset/resource files, such as images.
75+
- **Sources to copy** determines which sources are copied to the remote computer. By default, the **\@(SourcesToCopyRemotely)** defaults to all source code files in the project, but doesn't include any asset/resource files, such as images.
7676

7777
- **Copy sources** can be turned on and off to enable and disable the copying of source files to the remote computer.
7878

79-
- **Additional sources to copy** allows you to add additional source files which will be copied to the remote system. You can specify a semi-colon delimited list, or you can use the **:=** syntax to specify a local and remote name to use:
79+
- **Additional sources to copy** allows you to add additional source files, which will be copied to the remote system. You can specify a semi-colon delimited list, or you can use the **:=** syntax to specify a local and remote name to use:
8080

8181
`C:\Projects\ConsoleApplication1\MyFile.cpp:=~/projects/ConsoleApplication1/ADifferentName.cpp;C:\Projects\ConsoleApplication1\MyFile2.cpp:=~/projects/ConsoleApplication1/ADifferentName2.cpp;`
8282

@@ -117,6 +117,10 @@ You can enable logging to help troubleshoot problems:
117117

118118
::: moniker-end
119119

120+
## <a name="locale"></a> Linux target locale
121+
122+
Visual Studio language settings aren't propagated to Linux targets because Visual Studio doesn't manage or configure installed packages. Messages shown in the **Output** window, such as build errors, are shown using the language and locale of the Linux target. You'll need to configure your Linux targets for the desired locale.
123+
120124
## See also
121125

122126
[Set compiler and build properties](../build/working-with-project-properties.md)<br/>

0 commit comments

Comments
 (0)