Skip to content

Commit eafcfc5

Browse files
authored
Merge pull request #491 from tonyhallett/update-coverage-tools
Update coverage tools
2 parents 3673239 + 5f50e6b commit eafcfc5

10 files changed

+119
-21
lines changed

FineCodeCoverage.sln

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{20
1212
.github\workflows\addVsixLinkToIssues.yaml = .github\workflows\addVsixLinkToIssues.yaml
1313
CHANGELOG.md = CHANGELOG.md
1414
CONTRIBUTING.md = CONTRIBUTING.md
15+
dev-readmes\coverage-tool-zips.md = dev-readmes\coverage-tool-zips.md
1516
ISSUE_TEMPLATE.md = ISSUE_TEMPLATE.md
1617
LICENSE = LICENSE
1718
.github\workflows\push_pull.yaml = .github\workflows\push_pull.yaml

FineCodeCoverage/FineCodeCoverage.csproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -105,24 +105,24 @@
105105
<Link>ZippedTools\microsoft.testplatform.16.9.1.zip</Link>
106106
<IncludeInVSIX>true</IncludeInVSIX>
107107
</Content>
108-
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.3.2.0.zip">
109-
<Link>ZippedTools\coverlet.collector.3.2.0.zip</Link>
108+
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
109+
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
110110
<IncludeInVSIX>true</IncludeInVSIX>
111111
</Content>
112-
<Content Include="..\Shared Files\ZippedTools\coverlet.console.3.2.0.zip">
113-
<Link>ZippedTools\coverlet.console.3.2.0.zip</Link>
112+
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
113+
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
114114
<IncludeInVSIX>true</IncludeInVSIX>
115115
</Content>
116-
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
117-
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
116+
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.13.0.zip">
117+
<Link>ZippedTools\microsoft.codecoverage.17.13.0.zip</Link>
118118
<IncludeInVSIX>true</IncludeInVSIX>
119119
</Content>
120-
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.9.0.zip">
121-
<Link>ZippedTools\microsoft.codecoverage.17.9.0.zip</Link>
120+
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.6.0.4.zip">
121+
<Link>ZippedTools\coverlet.collector.6.0.4.zip</Link>
122122
<IncludeInVSIX>true</IncludeInVSIX>
123123
</Content>
124-
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
125-
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
124+
<Content Include="..\Shared Files\ZippedTools\coverlet.console.6.0.4.zip">
125+
<Link>ZippedTools\coverlet.console.6.0.4.zip</Link>
126126
<IncludeInVSIX>true</IncludeInVSIX>
127127
</Content>
128128
<!--

FineCodeCoverage2022/FineCodeCoverage2022.csproj

+10-10
Original file line numberDiff line numberDiff line change
@@ -89,24 +89,24 @@
8989
<Link>Resources\LICENSE</Link>
9090
<IncludeInVSIX>true</IncludeInVSIX>
9191
</Content>
92-
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.3.2.0.zip">
93-
<Link>ZippedTools\coverlet.collector.3.2.0.zip</Link>
92+
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
93+
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
9494
<IncludeInVSIX>true</IncludeInVSIX>
9595
</Content>
96-
<Content Include="..\Shared Files\ZippedTools\coverlet.console.3.2.0.zip">
97-
<Link>ZippedTools\coverlet.console.3.2.0.zip</Link>
96+
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
97+
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
9898
<IncludeInVSIX>true</IncludeInVSIX>
9999
</Content>
100-
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
101-
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
100+
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.13.0.zip">
101+
<Link>ZippedTools\microsoft.codecoverage.17.13.0.zip</Link>
102102
<IncludeInVSIX>true</IncludeInVSIX>
103103
</Content>
104-
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.9.0.zip">
105-
<Link>ZippedTools\microsoft.codecoverage.17.9.0.zip</Link>
104+
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.6.0.4.zip">
105+
<Link>ZippedTools\coverlet.collector.6.0.4.zip</Link>
106106
<IncludeInVSIX>true</IncludeInVSIX>
107107
</Content>
108-
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
109-
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
108+
<Content Include="..\Shared Files\ZippedTools\coverlet.console.6.0.4.zip">
109+
<Link>ZippedTools\coverlet.console.6.0.4.zip</Link>
110110
<IncludeInVSIX>true</IncludeInVSIX>
111111
</Content>
112112
<None Include="source.extension.vsixmanifest">
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

SharedProject/Core/Coverlet/DataCollector/CoverletDataCollectorUtil.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ private void LogRun(string coverletSettings)
282282
public void Initialize(string appDataFolder,CancellationToken cancellationToken)
283283
{
284284
var zipDestination = toolUnzipper.EnsureUnzipped(appDataFolder, zipDirectoryName, zipPrefix, cancellationToken);
285-
var testAdapterPath = Path.Combine(zipDestination, "build", "netstandard1.0");
285+
var testAdapterPath = Path.Combine(zipDestination, "build", "netstandard2.0");
286286
TestAdapterPathArg = $@"""{testAdapterPath}""";
287287
}
288288
}

dev-readmes/coverage-tool-zips.md

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# Updating coverage tool zips procedure
2+
3+
FCC uses 3 coverage providers, these are zip files included in the VSIX.
4+
These get extracted to AppData\Local\FineCodeCoverage
5+
6+
You need to debug FCC to ensure updates to these zips work. This will override the existing.
7+
8+
## All updated zips will need to follow this procedure.
9+
10+
1. Add to \FineCodeCoverage\Shared Files\ZippedTools directory
11+
2. Add as a linked file to the FineCodeCoverage and FineCodeCoverage2022 projects
12+
13+
Expand the project in solution explorer
14+
Right click on the ZippedTools directory
15+
Add -> Existing Item
16+
Navigate to \FineCodeCoverage\Shared Files\ZippedTools
17+
In the browser dialog select All files to see the zips
18+
Select the zip you want to add
19+
Click the drop down arrow on the Add button and select Add as Link
20+
21+
3. Set the Build properties in the properties window
22+
23+
Select the file
24+
Set Build Action to Content
25+
Set Include in VSIX to True
26+
27+
4. Remove the previous zip in solution explorer
28+
29+
5. For all updated zips debug an appropriate project ( details follow ) and if coverage is provided the old zip can be deleted from \FineCodeCoverage\Shared Files\ZippedTools
30+
31+
## How to update the zips
32+
33+
### msCodeCoverage
34+
35+
1. [Download the nuget package](https://www.nuget.org/packages/Microsoft.CodeCoverage/).
36+
2. Change the file extension to zip
37+
3. Check to see if the zip is compatible
38+
39+
The name should be of the form microsoft.codecoverage.VERSION.zip
40+
It needs to be compatible with MsCodeCoverageRunSettingsService
41+
42+
```csharp
43+
public void Initialize(string appDataFolder, IFCCEngine fccEngine, CancellationToken cancellationToken)
44+
{
45+
this.fccEngine = fccEngine;
46+
var zipDestination = toolUnzipper.EnsureUnzipped(appDataFolder, zipDirectoryName,zipPrefix, cancellationToken);
47+
fccMsTestAdapterPath = Path.Combine(zipDestination, "build", "netstandard2.0");
48+
shimPath = Path.Combine(zipDestination, "build", "netstandard2.0", "CodeCoverage", "coreclr", "Microsoft.VisualStudio.CodeCoverage.Shim.dll");
49+
}
50+
```
51+
52+
The fccMsTestAdapterPath needs to be a directory that contains a ...collector.dll which is currently called Microsoft.VisualStudio.TraceDataCollector.dll.
53+
The shimPath needs to exist.
54+
55+
4. Add the zip to the solution - see instruction at the top of this page.
56+
5. Debug
57+
58+
Debug a project with the option MsCodeCoverage Yes
59+
60+
### coverletCollector
61+
62+
1. [Download the nuget package](https://www.nuget.org/packages/coverlet.collector/).
63+
2. Change the file extension to zip
64+
3. Check to see if the zip is compatible
65+
The name should be of the form coverlet.collector.VERSION.zip
66+
It needs to be compatible with CoverletDataCollectorUtil
67+
68+
```csharp
69+
public void Initialize(string appDataFolder,CancellationToken cancellationToken)
70+
{
71+
var zipDestination = toolUnzipper.EnsureUnzipped(appDataFolder, zipDirectoryName, zipPrefix, cancellationToken);
72+
var testAdapterPath = Path.Combine(zipDestination, "build", "netstandard2.0");
73+
TestAdapterPathArg = $@"""{testAdapterPath}""";
74+
}
75+
```
76+
77+
Given that it is a data collector like msCodeCoverage the testAdapterPath needs to be a directory that contains a ...collector.dll which is currently called coverlet.collector.dll. 4. Add the zip to the solution - see instruction at the top of this page. 5. Debug
78+
79+
Debug an SDK style project with RunMsCodeCoverage No and with the test project having an MSBuild property `<UseDataCollector/>`
80+
81+
### coverlet
82+
83+
1. dotnet tool install --global coverlet.console
84+
85+
This will create or update installation in username/.dotnet/tools directory
86+
87+
2. Create a directory - coverlet.console.VERSION
88+
3. Create a sub directory - .store
89+
90+
Copy the following from within username/.dotnet/tools
91+
coverlet.exe into coverlet.console.VERSION
92+
coverlet.console dirctory into .store.
93+
94+
4. Add the zip to the solution - see instruction at the top of this page.
95+
5. Debug
96+
97+
Debug an SDK style project with RunMsCodeCoverage No and with the test project **not** having an MSBuild property `<UseDataCollector/>`

0 commit comments

Comments
 (0)