Skip to content

Commit 2c098fa

Browse files
Preview 4 branch snap into release/3.0 (dotnet#531)
Preview 4 branch snap into release/3.0
1 parent c335086 commit 2c098fa

File tree

249 files changed

+104288
-20876
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

249 files changed

+104288
-20876
lines changed

.editorconfig

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# editorconfig.org
2+
3+
# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos.
4+
5+
# top-most EditorConfig file
6+
root = true
7+
8+
# Default settings:
9+
# A newline ending every file
10+
# Use 4 spaces as indentation
11+
[*]
12+
insert_final_newline = true
13+
indent_style = space
14+
indent_size = 4
15+
16+
[project.json]
17+
indent_size = 2
18+
19+
# C# files
20+
[*.cs]
21+
# New line preferences
22+
csharp_new_line_before_open_brace = all
23+
csharp_new_line_before_else = true
24+
csharp_new_line_before_catch = true
25+
csharp_new_line_before_finally = true
26+
csharp_new_line_before_members_in_object_initializers = true
27+
csharp_new_line_before_members_in_anonymous_types = true
28+
csharp_new_line_between_query_expression_clauses = true
29+
30+
# Indentation preferences
31+
csharp_indent_block_contents = true
32+
csharp_indent_braces = false
33+
csharp_indent_case_contents = true
34+
csharp_indent_switch_labels = true
35+
csharp_indent_labels = one_less_than_current
36+
37+
# avoid this. unless absolutely necessary
38+
dotnet_style_qualification_for_field = false:suggestion
39+
dotnet_style_qualification_for_property = false:suggestion
40+
dotnet_style_qualification_for_method = false:suggestion
41+
dotnet_style_qualification_for_event = false:suggestion
42+
43+
# only use var when it's obvious what the variable type is
44+
csharp_style_var_for_built_in_types = false:none
45+
csharp_style_var_when_type_is_apparent = false:none
46+
csharp_style_var_elsewhere = false:suggestion
47+
48+
# use language keywords instead of BCL types
49+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
50+
dotnet_style_predefined_type_for_member_access = true:suggestion
51+
52+
# name all constant fields using PascalCase
53+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
54+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
55+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
56+
57+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
58+
dotnet_naming_symbols.constant_fields.required_modifiers = const
59+
60+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
61+
62+
# static fields should have s_ prefix
63+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
64+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
65+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
66+
67+
dotnet_naming_symbols.static_fields.applicable_kinds = field
68+
dotnet_naming_symbols.static_fields.required_modifiers = static
69+
70+
dotnet_naming_style.static_prefix_style.required_prefix = s_
71+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
72+
73+
# internal and private fields should be _camelCase
74+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
75+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
76+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
77+
78+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
79+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
80+
81+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
82+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
83+
84+
# Code style defaults
85+
dotnet_sort_system_directives_first = true
86+
csharp_preserve_single_line_blocks = true
87+
csharp_preserve_single_line_statements = false
88+
89+
# Expression-level preferences
90+
dotnet_style_object_initializer = true:suggestion
91+
dotnet_style_collection_initializer = true:suggestion
92+
dotnet_style_explicit_tuple_names = true:suggestion
93+
dotnet_style_coalesce_expression = true:suggestion
94+
dotnet_style_null_propagation = true:suggestion
95+
96+
# Expression-bodied members
97+
csharp_style_expression_bodied_methods = false:none
98+
csharp_style_expression_bodied_constructors = false:none
99+
csharp_style_expression_bodied_operators = false:none
100+
csharp_style_expression_bodied_properties = true:none
101+
csharp_style_expression_bodied_indexers = true:none
102+
csharp_style_expression_bodied_accessors = true:none
103+
104+
# Pattern matching
105+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
106+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
107+
csharp_style_inlined_variable_declaration = true:suggestion
108+
109+
# Null checking preferences
110+
csharp_style_throw_expression = true:suggestion
111+
csharp_style_conditional_delegate_call = true:suggestion
112+
113+
# Space preferences
114+
csharp_space_after_cast = false
115+
csharp_space_after_colon_in_inheritance_clause = true
116+
csharp_space_after_comma = true
117+
csharp_space_after_dot = false
118+
csharp_space_after_keywords_in_control_flow_statements = true
119+
csharp_space_after_semicolon_in_for_statement = true
120+
csharp_space_around_binary_operators = before_and_after
121+
csharp_space_around_declaration_statements = do_not_ignore
122+
csharp_space_before_colon_in_inheritance_clause = true
123+
csharp_space_before_comma = false
124+
csharp_space_before_dot = false
125+
csharp_space_before_open_square_brackets = false
126+
csharp_space_before_semicolon_in_for_statement = false
127+
csharp_space_between_empty_square_brackets = false
128+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
129+
csharp_space_between_method_call_name_and_opening_parenthesis = false
130+
csharp_space_between_method_call_parameter_list_parentheses = false
131+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
132+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
133+
csharp_space_between_method_declaration_parameter_list_parentheses = false
134+
csharp_space_between_parentheses = false
135+
csharp_space_between_square_brackets = false
136+
137+
# C++ Files
138+
[*.{cpp,h,in}]
139+
curly_bracket_next_line = true
140+
indent_brace_style = Allman
141+
142+
# Xml project files
143+
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
144+
indent_size = 2
145+
146+
# Xml build files
147+
[*.builds]
148+
indent_size = 2
149+
150+
# Xml files
151+
[*.{xml,stylecop,resx,ruleset}]
152+
indent_size = 2
153+
154+
# Xml config files
155+
[*.{props,targets,config,nuspec}]
156+
indent_size = 2
157+
158+
# Shell scripts
159+
[*.sh]
160+
end_of_line = lf
161+
[*.{cmd, bat}]
162+
end_of_line = crlf

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ bld/
2626

2727
# Visual Studio 2015/2017 cache/options directory
2828
.vs/
29+
.vscode/
2930
# Uncomment if you have tasks that create the project's static files in wwwroot
3031
#wwwroot/
3132

Directory.Build.props

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project>
3-
<PropertyGroup>
4-
<ImportNetSdkFromRepoToolset>false</ImportNetSdkFromRepoToolset>
5-
6-
<PublishWindowsPdb>true</PublishWindowsPdb>
2+
<!-- Normalize $(TestWpfArcadeSdkPath) by appending a '\' to it if one is missing -->
3+
<PropertyGroup Condition="'$(TestWpfArcadeSdkPath)'!=''">
4+
<WpfArcadeSdkPath>$(TestWpfArcadeSdkPath)</WpfArcadeSdkPath>
5+
<WpfArcadeSdkPath Condition="!$(WpfArcadeSdkPath.EndsWith('\'))">$(TestWpfArcadeSdkPath)\</WpfArcadeSdkPath>
76
</PropertyGroup>
87

9-
<Import Project="$(MsBuildThisFileDirectory)SystemResources.props"/>
10-
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Arcade.Sdk" />
11-
12-
<PropertyGroup>
13-
<DebugType>full</DebugType>
8+
<PropertyGroup Condition="'$(TestWpfArcadeSdkPath)'=='' And Exists('$(MSBuildThisFileDirectory)eng\WpfArcadeSdk\')">
9+
<WpfArcadeSdkPath>$(MSBuildThisFileDirectory)eng\WpfArcadeSdk\</WpfArcadeSdkPath>
10+
</PropertyGroup>
11+
<!-- Select Sdk.props from test location or eng\WpfArcadeSdk\. If neither exists, then fall back to the use of one
12+
obtained using MSBuild's Sdk resolver -->
13+
<PropertyGroup Condition="Exists('$(WpfArcadeSdkPath)')">
14+
<WpfArcadeSdkProps>$(WpfArcadeSdkPath)Sdk\Sdk.props</WpfArcadeSdkProps>
15+
<WpfArcadeSdkTargets>$(WpfArcadeSdkPath)Sdk\Sdk.targets</WpfArcadeSdkTargets>
1416
</PropertyGroup>
17+
18+
19+
<Import Project="$(WpfArcadeSdkProps)"
20+
Condition="Exists('$(WpfArcadeSdkProps)') And Exists('$(WpfArcadeSdkTargets)')"/>
21+
22+
<Import Sdk="Microsoft.DotNet.Arcade.Wpf.Sdk"
23+
Project="Sdk.props"
24+
Condition="!Exists('$(WpfArcadeSdkProps)') Or !Exists('$(WpfArcadeSdkTargets)')"/>
1525
</Project>

Directory.Build.targets

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project>
3-
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
4-
<Import Project="$(MSBuildThisFileDirectory)Packaging.targets" />
5-
<Import Project="$(MSBuildThisFileDirectory)Publishing.targets" />
2+
3+
<Import Project="$(WpfArcadeSdkTargets)"
4+
Condition="Exists('$(WpfArcadeSdkProps)') And Exists('$(WpfArcadeSdkTargets)')"/>
5+
6+
<Import Sdk="Microsoft.DotNet.Arcade.Wpf.Sdk"
7+
Project="Sdk.targets"
8+
Condition="!Exists('$(WpfArcadeSdkProps)') Or !Exists('$(WpfArcadeSdkTargets)')"/>
69
</Project>

Documentation/contributing.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ See [Developer Guide](developer-guide.md) to learn how to develop changes for th
1313

1414
This project follows the general [.NET Core Contribution Guidelines](https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/contributing.md). The contribution bar from the general contribution guidelines is copied below.
1515

16-
## Do not change files in the `Shared` directory
16+
## Do not change files in the `Shared`, `WindowsBase`, `PresentationCore`, and `PresentationFramework` directories
1717

18-
The directory [`src/Microsoft.DotNet.Wpf/src/Shared`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/Shared) contains files that are shared between the public GitHub repo and the internal WPF repos. Changes to files in this directory will *not* be accepted since they also affect internal code. Once all the appropriate source has been published to the public repo, this restriction will no longer be needed.
18+
The directories [`src/Microsoft.DotNet.Wpf/src/Shared`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/Shared), [`src/Microsoft.DotNet.Wpf/src/WindowsBase`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/WindowsBase), [`src/Microsoft.DotNet.Wpf/src/PresentationCore`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/PresentationCore), [`src/Microsoft.DotNet.Wpf/src/PresentationFramework`](https://github.com/dotnet/wpf/tree/master/src/Microsoft.DotNet.Wpf/src/PresentationFramework) contains files that are shared between the public GitHub repo and the internal WPF repos. Changes to files in this directory will *not* be accepted since they also affect internal code. Once all the appropriate sources have been published to the public repo, this restriction will no longer be needed.
1919

2020
## Contribution "Bar"
2121

@@ -26,3 +26,13 @@ Maintainers will not merge changes that have narrowly-defined benefits due to co
2626
Most .NET Core components are cross-platform and we appreciate contributions that either improve their feature set in a given environment or that add support for a new environment. We will typically not accept contributions that implement support for an OS-specific technolology on another operating system. For example, we do not intend to create an implementation of the Windows registry for Linux or an implementation of the macOS keychain for Windows. We also do not intend to accept contributions that provide cross-platform implementations for Windows Forms or WPF.
2727

2828
Contributions must also satisfy the other published guidelines defined in this document.
29+
30+
## Code Formatting Improvements and Minor Enhancements
31+
32+
We will consider code-formatting improvements that are identified by running code analyzers.
33+
34+
Our CodeAnalysis rules are not enabled by default. These can be enabled by setting the MSBuild property `EnableAnalyzers=true` (in commandline, it is set as `/p:EnableAnalyzers=true`).
35+
36+
The code analyzer would likely recommend changes that can result in changes to the generated IL. In general, we prefer code-formatting PR's to be limited to changes that do not have any impact on the IL - these are easier to review and approve and do not require additional testing.
37+
38+
Please open issues for changes that affect the IL or might require additional validation, and work with the project maintainers to determine whether a PR would be appropriate.
137 KB
Loading

Documentation/packaging.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Packaging
2+
3+
Packaging is implemented in the following files:
4+
5+
```
6+
$(WpfArcadeSdkToolsDir)\Packaging.props
7+
$(WpfArcadeSdkToolsDir)\Packaging.targets
8+
$(RepoRoot)\packaging\**\*
9+
10+
├───Microsoft.DotNet.Arcade.Wpf.Sdk
11+
│ Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj
12+
13+
├───Microsoft.DotNet.Wpf.DncEng
14+
│ Microsoft.DotNet.Wpf.DncEng.ArchNeutral.csproj
15+
│ Microsoft.DotNet.Wpf.DncEng.csproj
16+
17+
└───Microsoft.DotNet.Wpf.GitHub
18+
Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj
19+
Microsoft.DotNet.Wpf.GitHub.csproj
20+
21+
```
22+
23+
- The `ArchNeutral` packages are built only during the `x86` (i.e., `AnyCPU`) build phase
24+
- Normally, the `ArchNeutral` packages will contain a `runtime.json` file that incorporates the *Bait & Switch* technique for referencing RID-specific packages automatically.
25+
- `runtime.json` functionality is turned off when a packaging project requests so by setting `$(PlatformIndependentPackage)=true`.
26+
- See [Improve documentation - bait and switch pattern, other #1282 ](https://github.com/NuGet/docs.microsoft.com-nuget/issues/1282)
27+
28+
29+
- The packages that are not `ArchNeutral` are architecture-specific, and will produce packages containing the RID (`win-x86`, `win-x64`) as a prefix
30+
- The arch-specific packages are produced in each of the build phases.
31+
32+
#### Package Names
33+
34+
There are two packages produced out of this repo, a *transport* package and an *MsBuild Sdk* package:
35+
36+
- `Microsoft.DotNet.Wpf.Github`
37+
- This contains assemblies and corresponding reference binaries that are currently built out of this repo ([https://www.github.com/dotnet/wpf](https://www.github.com/dotnet/wpf)).
38+
- `Microsoft.DotNet.Arcade.Wpf.Sdk`
39+
- This is an *MsBuild Sdk*, and is and extension to [Microsoft.DotNet.Arcade.Sdk](https://www.github.com/dotnet/arcade).
40+
- This Sdk contains all the build props, targets and scripts needed to build WPF.
41+
- Since WPF's build is split across two repos, we build this Sdk out of one repo, and consume it as an *MsBuild Sdk* in the other repo.
42+
43+
#### Opting into a package
44+
45+
- An assembly opts-into a package in `$(WpfArcadeSdkToolsDir)\Packaging.props` by simply setting the `PackageName` property, for e.g., like this:
46+
47+
`<PackageName Condition="'$(MSBuildProjectName)'=='WpfGfx'">$(DncEngTransportPackageName)</PackageName>`
48+
49+
In practice, this is not needed. *Shipping* assemblies are already enumerated in detail within `$(WpfArcadeSdkToolsDir)ShippingProjects.props`, and each one of them is marked for packaging correctly within `Packaging.props` based on its `$(RepoLocation)` value (possible values are `{Internal, External}`)
50+
51+
- These package names that various assembly projects can opt to be packaged into are defined in `$(WpfArcadeSdkToolsDir)\Packaging.props`. The project names under `$(RepoRoot)\packaging\` must match these.
52+
53+
#### How Packaging Works
54+
55+
##### Preparing Package Assets (*`PreparePackageAssets`* target)
56+
57+
- *`PreparePackageAssets`* target is defined in `$(WpfArcadeSdkToolsDir)Packaging.targets`
58+
- It runs after *`Build`*, and copies all project outputs, symbols, reference assemblies, satellite assemblies, and content files (defined in *`@(PackageContent)`* `ItemGroup`) to `$(ArtifactsPackagingDir)$(PackageName)\lib\$(TargetFrameworkOrRuntimeIdentifier)\`
59+
- If `@(PackagingAssemblyContent)` is populated, then only those files from `$(OutDir)` would be copied and packaged further - and none others would be included.
60+
- At the end of this target, all files that need to be packed would have been laid out in the right folder hierarchy, and ready to be packed.
61+
62+
##### Populate the `@(Content)` itemgroup with custom lsit of package-assets (*`CreateContentFolder`* target)
63+
64+
- *`CreateContentFolder`* is defined in `$(WpfArcadeSdkToolsDir)Packaging.targets`
65+
- It runs just before *`GenerateNuspec`* target, and populates `@(Content)` with files that were copied during *`PreparePackageAssets`*
66+
- This is consume by NuGet `PackTask` to create the package.
67+
68+
##### Create a Nuget Package
69+
70+
- The projects under `$(RepoRoot)\packaging` are the only ones with `$(IsPackable)=true`
71+
- The layout of the generated package is identical to the layout under `$(ArtifactsPackagindir)$(PackageName)\`
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Solution and Project Configuration
2+
3+
Solutions configurations are mapped to Project configurations in the following manner.
4+
5+
<font face="consolas">
6+
<table>
7+
<tr>
8+
<th>Solution</th>
9+
<th>Managed Projects</th>
10+
<th>Native Projects</th>
11+
</tr>
12+
<tr>
13+
<td>Debug|AnyCPU</td>
14+
<td>Debug|AnyCPU</td>
15+
<td>Debug|<font color="red">Win32</font></td>
16+
</tr>
17+
<tr>
18+
<td>Debug|x86</td>
19+
<td>Debug|<font color="red">AnyCPU</font></td>
20+
<td>Debug|<font color="blue">Win32</font></td>
21+
</tr>
22+
<tr>
23+
<td>Debug|x64</td>
24+
<td>Debug|x64</td>
25+
<td>Debug|x64</td>
26+
</tr>
27+
<tr>
28+
<td>Release|AnyCPU</td>
29+
<td>Release|AnyCPU</td>
30+
<td>Release|<font color="red">Win32</font></td>
31+
</tr>
32+
<tr>
33+
<td>Release|x86</td>
34+
<td>Release|<font color="red">AnyCPU</red></td>
35+
<td>Release|<font color="blue">Win32</font></td>
36+
</tr>
37+
<tr>
38+
<td>Release|x64</td>
39+
<td>Release|x64</td>
40+
<td>Release|x64</td>
41+
</tr>
42+
</table>
43+
</font>
44+
45+
46+
- `AnyCPU` **solution** configuration is intended for developer-builds only.
47+
- Official build would *always* specify `x86` or `x64` solution configurations explicitly.
48+
- Native projects should map `AnyCPU` solution-configuration to `x86` project configuration
49+
- Managed projects should map `x86` solution-configuration to `AnyCPU` project configuration
50+
- Use Solution->Properties->Configuration view to ensure that the mapping between solution-configuration and project configuration is consistent for every possible configuration.
51+
- Note that packaging projects under `nupkg` folder have only one (`AnyCPU`) configuration
52+
53+
![](images/configurations.png)

0 commit comments

Comments
 (0)