diff --git a/Directory.Build.props b/Directory.Build.props
index 0574f6480b2..8fb0901638d 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -13,10 +13,28 @@
MIT
-
-
-
- Full
+
+
+
+ portable
+
+ false
+
+
+
+ true
+ true
+ true
+ opencover
+ [System.Windows.*]*
+
+
+ Obsolete,ExcludeFromCodeCoverage
+
+
+
+
+
diff --git a/Directory.Build.targets b/Directory.Build.targets
index 739fb0a4338..1c42e035aa0 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -8,5 +8,18 @@
-
+
+
+ $(TargetDir)coverage\$(MSBuildProjectName).coverage
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index ec2b9f6cd06..e23435ac7b1 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
# Windows Forms
-[](https://dnceng.visualstudio.com/public/_build/latest?definitionId=267&branch=master)
+[](https://dnceng.visualstudio.com/public/_build/latest?definitionId=267&branch=master)
+[](https://codecov.io/gh/dotnet/winforms)
[](https://github.com/dotnet/winforms/blob/master/LICENSE.TXT)
Windows Forms (WinForms) is a UI framework for building Windows desktop applications. It is a .NET wrapper over Windows user interface libraries, such as User32 and GDI+. It also offers controls and other functionality that is unique to Windows Forms.
diff --git a/codecov.yml b/codecov.yml
new file mode 100644
index 00000000000..de20aaa596c
--- /dev/null
+++ b/codecov.yml
@@ -0,0 +1,34 @@
+# https://docs.codecov.io/docs/codecov-yaml
+# https://github.com/codecov/support/wiki/Codecov-Yaml
+
+coverage:
+ status:
+ project:
+ default: false
+ patch:
+ default: false
+ fixes:
+ - "eng/::/"
+
+comment:
+ layout: "diff, flags"
+
+flags:
+ production:
+ paths:
+ - src/Common/src/
+ - src/System.Design/src/
+ - src/System.Drawing/src/
+ - src/System.Drawing.Design/src/
+ - src/System.Windows.Forms/src/
+ - src/System.Windows.Forms.Design/src/
+ - src/System.Windows.Forms.Design.Editors/src/
+ test:
+ paths:
+ - src/Common/tests/
+ - src/System.Design/tests/
+ - src/System.Drawing/tests/
+ - src/System.Drawing.Design/tests/
+ - src/System.Windows.Forms/tests/
+ - src/System.Windows.Forms.Design/tests/
+ - src/System.Windows.Forms.Design.Editors/tests/
diff --git a/eng/CodeCoverage.proj b/eng/CodeCoverage.proj
new file mode 100644
index 00000000000..7b2df18f60a
--- /dev/null
+++ b/eng/CodeCoverage.proj
@@ -0,0 +1,61 @@
+
+
+
+
+ netcoreapp3.0
+
+
+
+
+
+
+
+
+ <_CodecovPath>$(NuGetPackageRoot)codecov\$(CodecovVersion)\tools\Codecov.exe
+ <_ReportGeneratorPath>$(NuGetPackageRoot)reportgenerator\$(ReportGeneratorVersion)\tools\net47\ReportGenerator.exe
+
+
+ <_BranchName Condition="'$(_BranchName)' == ''">$(SYSTEM_PULLREQUEST_SOURCEBRANCH)
+ <_BranchName Condition="'$(_BranchName)' == ''">$(BUILD_SOURCEBRANCHNAME)
+
+
+
+
+ <_CoverageReports Include="$(ArtifactsBinDir)*\$(Configuration)\*\coverage\*.coverage" />
+
+
+
+
+
+
+
+
+ <_CodecovArgs Include="-f;$(BaseOutputPath)coverage\Cobertura.xml" />
+ <_CodecovArgs Include="-r;$(BUILD_REPOSITORY_NAME)" Condition="'$(BUILD_REPOSITORY_NAME)' != ''" />
+ <_CodecovArgs Include="--pr;$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)" Condition="'$(SYSTEM_PULLREQUEST_PULLREQUESTNUMBER)' != ''" />
+ <_CodecovArgs Include="-b;$(BUILD_BUILDNUMBER)" Condition="'$(BUILD_BUILDNUMBER)' != ''" />
+ <_CodecovArgs Include="--branch;$(_BranchName)" Condition="'$(_BranchName)' != ''" />
+ <_CodecovArgs Include="-c;$(BUILD_SOURCEVERSION)" Condition="'$(BUILD_SOURCEVERSION)' != ''" />
+ <_CodecovArgs Include="-n;$(BUILD_DEFINITIONNAME)" Condition="'$(BUILD_DEFINITIONNAME)' != ''" />
+ <_CodecovArgs Include="-t;$(CodeCovToken)" Condition="'$(CodeCovToken)' != ''" />
+
+ <_CodecovFlags Include="$(Configuration)" Condition="'$(Configuration)' != ''" />
+ <_CodecovProductionFlags Include="@(_CodecovFlags)" />
+ <_CodecovProductionFlags Include="production" />
+ <_CodecovTestFlags Include="@(_CodecovFlags)" />
+ <_CodecovTestFlags Include="test" />
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/eng/FacadeAssemblies.props b/eng/FacadeAssemblies.props
index e5a199c1fcd..452d4884d96 100644
--- a/eng/FacadeAssemblies.props
+++ b/eng/FacadeAssemblies.props
@@ -9,6 +9,9 @@
true
true
+
+ full
+
net472
$(NoWarn);NU1701
diff --git a/eng/Versions.props b/eng/Versions.props
index 13130300afd..7450a9c0441 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -33,6 +33,12 @@
$(XUnitVersion)
0.3.5
+
+
+ 2.6.0
+ 1.1.1
+ 4.0.9
+
4.6.0-alpha-27122-5
diff --git a/eng/ci.yml b/eng/ci.yml
index d663be4addc..26f4c196430 100644
--- a/eng/ci.yml
+++ b/eng/ci.yml
@@ -109,8 +109,10 @@ jobs:
_PublishType: none
_SignType: test
_DotNetPublishToBlobFeed : false
+ _Coverage: true
Build_Release:
_BuildConfig: Release
+ _Coverage: false
steps:
- checkout: self
@@ -121,22 +123,29 @@ jobs:
displayName: Pre-Build - Set VSO Variables
# Build and rename binlog
+ # Note: The /p:Coverage argument is passed here since some build properties change to accommodate running with
+ # coverage. This is part of the workarounds for https://github.com/tonerdo/coverlet/issues/362 and
+ # https://github.com/tonerdo/coverlet/issues/363.
- script: eng\cibuild.cmd
-prepareMachine
-configuration $(_BuildConfig)
$(_OfficialBuildIdArgs)
-build
+ /p:Coverage=$(_Coverage)
/bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\Build.binlog
displayName: Build
# Run Unit Tests
# this should no longer be necessary once Helix is ready to report back code coverage
+ # Tests are run with /m:1 to work around https://github.com/tonerdo/coverlet/issues/364
- script: eng\cibuild.cmd
-prepareMachine
-configuration $(_BuildConfig)
$(_OfficialBuildIdArgs)
-test
- /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\Test.binlog #SendToHelix.binlog for helix version
+ /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\Test.binlog
+ /p:Coverage=$(_Coverage)
+ /m:1
displayName: Run Unit Tests on Build Machine (Debug only)
condition: and(succeeded(), eq(variables['_BuildConfig'], 'Debug')) # on build machine (with test signing)
@@ -172,6 +181,15 @@ jobs:
/bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\PackSignPublish.binlog
displayName: Pack, Sign, and Publish
+ # Upload code coverage data
+ - script: $(Build.SourcesDirectory)/.dotnet/dotnet msbuild
+ eng/CodeCoverage.proj
+ /p:Configuration=$(_BuildConfig)
+ /p:CodeCovToken=$(CODECOV_TOKEN)
+ /bl:$(BUILD.SOURCESDIRECTORY)\artifacts\log\$(_BuildConfig)\CodeCoverage.binlog
+ displayName: Upload coverage to codecov.io
+ condition: and(succeeded(), eq(variables._Coverage, 'true'))
+
# Perform some internal-build-only tasks
- ${{ if eq(parameters.runAsPublic, 'false') }}:
@@ -187,4 +205,4 @@ jobs:
# Run component governance detection (only for release; only for internal)
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
displayName: Component Governance Detection
- condition: and(succeeded(), eq(variables['_BuildConfig'], 'Release'))
+ condition: and(succeeded(), eq(variables['_BuildConfig'], 'Release'))
\ No newline at end of file
diff --git a/eng/packageContent.targets b/eng/packageContent.targets
index 1f7435dc224..c54045f7a15 100644
--- a/eng/packageContent.targets
+++ b/eng/packageContent.targets
@@ -2,7 +2,7 @@
ref/$(TargetFramework)
- true
+ true
true
diff --git a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj
index cfc914f9f80..1a2ad4a14fe 100644
--- a/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj
+++ b/src/System.Windows.Forms.Design.Editors/tests/UnitTests/System.Windows.Forms.Design.Editors.Tests.csproj
@@ -8,6 +8,7 @@
+
diff --git a/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj b/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj
index 72fa43c115d..2db090483e3 100644
--- a/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj
+++ b/src/System.Windows.Forms.Design/tests/UnitTests/System.Windows.Forms.Design.Tests.csproj
@@ -9,6 +9,7 @@
+
@@ -16,5 +17,5 @@
-
+
diff --git a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj
index 0a96110b08c..200a0387d28 100644
--- a/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj
+++ b/src/System.Windows.Forms/tests/IntegrationTests/System.Windows.Forms.IntegrationTests/System.Windows.Forms.IntegrationTests.csproj
@@ -9,6 +9,7 @@
+
diff --git a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj
index 91b28c24f6a..f8cbe2f2050 100644
--- a/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj
+++ b/src/System.Windows.Forms/tests/UnitTests/System.Windows.Forms.Tests.csproj
@@ -9,6 +9,7 @@
+