Skip to content

Commit e9dcf4c

Browse files
authored
Note for Linux users on MSBuild issues. (#795)
Note for Linux users on MSBuild issues.
1 parent 62ff6d7 commit e9dcf4c

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

Documentation/MSBuildIntegration.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ With Coverlet you can combine the output of multiple coverage runs into a single
7474
dotnet test /p:CollectCoverage=true /p:MergeWith='/path/to/result.json'
7575
```
7676

77-
The value given to `/p:MergeWith` **must** be a path to Coverlet's own json result format. The results in `result.json` will be read, and added to the new results written to by Coverlet.
77+
The value given to `/p:MergeWith` **must** be a path to Coverlet's own json result format. The results in `result.json` will be read, and added to the new results written to by Coverlet.
7878
[Check the sample](Examples.md).
7979

8080
## Threshold
@@ -168,6 +168,19 @@ VSTS builds do not require double quotes to be unescaped:
168168
dotnet test --configuration $(buildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:CoverletOutput=$(Build.SourcesDirectory)/TestResults/Coverage/ /p:Exclude="[MyAppName.DebugHost]*%2c[MyAppNamet.WebHost]*%2c[MyAppName.App]*"
169169
```
170170

171+
## Note for Linux users
172+
173+
[There is an issue with MSBuild on Linux](https://github.com/microsoft/msbuild/issues/3468) affects the ability to escape quotes while specifying multiple comma-separated values. Linux MSBuild automatically translates `\` to `/` in properties, tasks, etc. before using them, which means if you specified `/p:CoverletOutputFormat=\"json,opencover\"` in an MSBuild script, it will be converted to `/p:CoverletOutputFormat=/"json,opencover/"` before execution. This yields an error similar to the following:
174+
175+
```text
176+
MSBUILD : error MSB1006: Property is not valid. [/home/vsts/work/1/s/default.proj]
177+
Switch: opencover/
178+
```
179+
180+
You'll see this if directly consuming Linux MSBuild or if using the Azure DevOps `MSBuild` task on a Linux agent.
181+
182+
The workaround is to use the .NET Core `dotnet msbuild` command instead of using MSBuild directly. The issue is not present in `dotnet msbuild` and the script will run with correctly escaped quotes.
183+
171184
## SourceLink
172185

173186
Coverlet supports [SourceLink](https://github.com/dotnet/sourcelink) custom debug information contained in PDBs. When you specify the `--use-source-link` flag in the global tool or `/p:UseSourceLink=true` property in the MSBuild command, Coverlet will generate results that contain the URL to the source files in your source control instead of absolute file paths.

0 commit comments

Comments
 (0)