You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`.gitattributes` files are used to do things like specify separate merge strategies for individual files or directories in your project, tell Git how to diff non-text files, or have Git filter content before you check it into or out of Git. The default attributes are configured to safely allow cross platform development.
91
-
92
-
>**Note: `.gitattributes` relies on a [physical file path hierarchy](https://git-scm.com/docs/gitattributes) to work so after installing or updating the submodule you need to copy the `.gitattributes` file to the solution root before adding to Visual Studio.**
93
-
94
-
#### EditorConfig
95
-
96
-
Settings in `.editorconfig` files enable you to maintain consistent coding styles and settings in a codebase, such as indent style, tab width, end of line characters, encoding, and more, regardless of the editor or IDE you use. For example, when coding in C#, if your codebase has a convention to prefer that indents always consist of five space characters, documents use UTF-8 encoding, and each line always ends with a CR/LF, you can configure an `.editorconfig` file to do that.
97
-
98
-
Adding an `.editorconfig` file to your project or codebase does not convert existing styles to the new ones. For example, if you have indents in your file that are formatted with tabs, and you add an `.editorconfig` file that indents with spaces, the indent characters are not automatically converted to spaces. However, any new lines of code are formatted according to the `.editorconfig` file. Additionally, if you format the document using <kbd>Ctrl+K, Ctrl+E</kbd>), the settings in the `.editorconfig` file are applied to existing lines of code.
99
-
100
-
>**Note: `.editorconfig` relies on a [physical file path hierarchy](https://editorconfig.org/#file-location) to work so after installing or updating the submodule you need to copy the `.editorconfig` file to the solution root before adding to Visual Studio.**
101
-
102
-
To add an `.editorconfig` file to your solution open the solution in Visual Studio. Select the solution node and right-click.
103
-
104
-
From the menu bar, choose **Project > Add Existing Item**, or press <kbd>Shift+Alt+A</kbd>.
105
-
106
-
The Add Existing Item dialog box opens. Use this to navigate to your new **shared-infrastructure** folder and select the `.editorconfig` file.
107
-
108
-
An `.editorconfig` file appears in Solution Explorer, and it opens in the editor.
109
-
110
-

111
-
112
-
#### StyleCop Analyzers
113
-
114
-
StyleCop Analyzers are Roslyn Analyzer that contain an implementation of the StyleCop rules using the .NET Compiler Platform. Where possible, code fixes are also provided to simplify the process of correcting violations.
115
-
116
-
StyleCopAnalyzers can be installed using the NuGet command line or the NuGet Package Manager in Visual Studio 2019.
Once the Nuget package is installed you will should add the following configuration files to the **Solution Items** folder you created when installing the `.editorconfig` file so you can easily view the contents.
129
-
130
-
-`SixLabors.ruleset`
131
-
-`SixLabors.Tests.ruleset`
132
-
-`stylecop.json`
133
-
134
-
These files tell StyleCop what rules to enforce and will have to be manually added to each project. **right-click > Edit [YOUR_PROJECT_NAME].csproj**
135
-
136
-
```xml
137
-
<!--Use the 'SixLabors.Tests.ruleset' for your test projects-->
An up-to-date list of which StyleCop rules are implemented and which have code fixes can be found [here](https://dotnetanalyzers.github.io/StyleCopAnalyzers/).
148
-
149
-
### Using internal C# utility classes
150
-
151
-
To include internals like `Guard.cs`, `MathF`, and `HashCode` into your project you should add configuration like the following to your `.csproj`:
These tools are automatically installed into your solution by referencing the `.props` and `.targets` files found in the [/msbuild](/msbuild) folder.
210
90
211
-
And add the `SharedInfrastructure.shproj` as a project dependency.
91
+
### MsBuild
92
+
93
+
Within the aforementioned folder there are separate `.props` and `.targets` files designed for shared, src, and test scenarios. These files control the build process and are responsible for automatically referencing all the required projects for versioning, linting and testing. An example use case and installation can be found at the [ImageSharp](https://github.com/SixLabors/ImageSharp) repository.
212
94
213
-
*Note:* This might change as soon as we include shared msbuild infrastructure elements (`.props` and `.targets`)
0 commit comments