Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update coverage tools #491

Merged
merged 4 commits into from
Mar 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions FineCodeCoverage.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution", "Solution", "{20
.github\workflows\addVsixLinkToIssues.yaml = .github\workflows\addVsixLinkToIssues.yaml
CHANGELOG.md = CHANGELOG.md
CONTRIBUTING.md = CONTRIBUTING.md
dev-readmes\coverage-tool-zips.md = dev-readmes\coverage-tool-zips.md
ISSUE_TEMPLATE.md = ISSUE_TEMPLATE.md
LICENSE = LICENSE
.github\workflows\push_pull.yaml = .github\workflows\push_pull.yaml
Expand Down
20 changes: 10 additions & 10 deletions FineCodeCoverage/FineCodeCoverage.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,24 @@
<Link>ZippedTools\microsoft.testplatform.16.9.1.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.3.2.0.zip">
<Link>ZippedTools\coverlet.collector.3.2.0.zip</Link>
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\coverlet.console.3.2.0.zip">
<Link>ZippedTools\coverlet.console.3.2.0.zip</Link>
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.13.0.zip">
<Link>ZippedTools\microsoft.codecoverage.17.13.0.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.9.0.zip">
<Link>ZippedTools\microsoft.codecoverage.17.9.0.zip</Link>
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.6.0.4.zip">
<Link>ZippedTools\coverlet.collector.6.0.4.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
<Content Include="..\Shared Files\ZippedTools\coverlet.console.6.0.4.zip">
<Link>ZippedTools\coverlet.console.6.0.4.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<!--
Expand Down
20 changes: 10 additions & 10 deletions FineCodeCoverage2022/FineCodeCoverage2022.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,24 @@
<Link>Resources\LICENSE</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.3.2.0.zip">
<Link>ZippedTools\coverlet.collector.3.2.0.zip</Link>
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\coverlet.console.3.2.0.zip">
<Link>ZippedTools\coverlet.console.3.2.0.zip</Link>
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\reportGenerator.4.7.4.zip">
<Link>ZippedTools\reportGenerator.4.7.4.zip</Link>
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.13.0.zip">
<Link>ZippedTools\microsoft.codecoverage.17.13.0.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\microsoft.codecoverage.17.9.0.zip">
<Link>ZippedTools\microsoft.codecoverage.17.9.0.zip</Link>
<Content Include="..\Shared Files\ZippedTools\coverlet.collector.6.0.4.zip">
<Link>ZippedTools\coverlet.collector.6.0.4.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="..\Shared Files\ZippedTools\openCover.4.7.1221.zip">
<Link>ZippedTools\openCover.4.7.1221.zip</Link>
<Content Include="..\Shared Files\ZippedTools\coverlet.console.6.0.4.zip">
<Link>ZippedTools\coverlet.console.6.0.4.zip</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<None Include="source.extension.vsixmanifest">
Expand Down
Binary file not shown.
Binary file not shown.
Binary file removed Shared Files/ZippedTools/coverlet.console.3.2.0.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ private void LogRun(string coverletSettings)
public void Initialize(string appDataFolder,CancellationToken cancellationToken)
{
var zipDestination = toolUnzipper.EnsureUnzipped(appDataFolder, zipDirectoryName, zipPrefix, cancellationToken);
var testAdapterPath = Path.Combine(zipDestination, "build", "netstandard1.0");
var testAdapterPath = Path.Combine(zipDestination, "build", "netstandard2.0");
TestAdapterPathArg = $@"""{testAdapterPath}""";
}
}
Expand Down
97 changes: 97 additions & 0 deletions dev-readmes/coverage-tool-zips.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# Updating coverage tool zips procedure

FCC uses 3 coverage providers, these are zip files included in the VSIX.
These get extracted to AppData\Local\FineCodeCoverage

You need to debug FCC to ensure updates to these zips work. This will override the existing.

## All updated zips will need to follow this procedure.

1. Add to \FineCodeCoverage\Shared Files\ZippedTools directory
2. Add as a linked file to the FineCodeCoverage and FineCodeCoverage2022 projects

Expand the project in solution explorer
Right click on the ZippedTools directory
Add -> Existing Item
Navigate to \FineCodeCoverage\Shared Files\ZippedTools
In the browser dialog select All files to see the zips
Select the zip you want to add
Click the drop down arrow on the Add button and select Add as Link

3. Set the Build properties in the properties window

Select the file
Set Build Action to Content
Set Include in VSIX to True

4. Remove the previous zip in solution explorer

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

## How to update the zips

### msCodeCoverage

1. [Download the nuget package](https://www.nuget.org/packages/Microsoft.CodeCoverage/).
2. Change the file extension to zip
3. Check to see if the zip is compatible

The name should be of the form microsoft.codecoverage.VERSION.zip
It needs to be compatible with MsCodeCoverageRunSettingsService

```csharp
public void Initialize(string appDataFolder, IFCCEngine fccEngine, CancellationToken cancellationToken)
{
this.fccEngine = fccEngine;
var zipDestination = toolUnzipper.EnsureUnzipped(appDataFolder, zipDirectoryName,zipPrefix, cancellationToken);
fccMsTestAdapterPath = Path.Combine(zipDestination, "build", "netstandard2.0");
shimPath = Path.Combine(zipDestination, "build", "netstandard2.0", "CodeCoverage", "coreclr", "Microsoft.VisualStudio.CodeCoverage.Shim.dll");
}
```

The fccMsTestAdapterPath needs to be a directory that contains a ...collector.dll which is currently called Microsoft.VisualStudio.TraceDataCollector.dll.
The shimPath needs to exist.

4. Add the zip to the solution - see instruction at the top of this page.
5. Debug

Debug a project with the option MsCodeCoverage Yes

### coverletCollector

1. [Download the nuget package](https://www.nuget.org/packages/coverlet.collector/).
2. Change the file extension to zip
3. Check to see if the zip is compatible
The name should be of the form coverlet.collector.VERSION.zip
It needs to be compatible with CoverletDataCollectorUtil

```csharp
public void Initialize(string appDataFolder,CancellationToken cancellationToken)
{
var zipDestination = toolUnzipper.EnsureUnzipped(appDataFolder, zipDirectoryName, zipPrefix, cancellationToken);
var testAdapterPath = Path.Combine(zipDestination, "build", "netstandard2.0");
TestAdapterPathArg = $@"""{testAdapterPath}""";
}
```

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

Debug an SDK style project with RunMsCodeCoverage No and with the test project having an MSBuild property `<UseDataCollector/>`

### coverlet

1. dotnet tool install --global coverlet.console

This will create or update installation in username/.dotnet/tools directory

2. Create a directory - coverlet.console.VERSION
3. Create a sub directory - .store

Copy the following from within username/.dotnet/tools
coverlet.exe into coverlet.console.VERSION
coverlet.console dirctory into .store.

4. Add the zip to the solution - see instruction at the top of this page.
5. Debug

Debug an SDK style project with RunMsCodeCoverage No and with the test project **not** having an MSBuild property `<UseDataCollector/>`
Loading