Using coverlet with. Net Framework generates an error: The expression "[System.Version]::Parse('')" canot be evaluated

Viewed 1517

I wrote a very simple c# .Net Framework applicatin and eddes som unit tests. Now, tring to check the coverage using coverlet. Getting error MSB4184. The expression "[System.Version]::Parse('')" canot be evaluated. Version string portion was too short or too long. (parameter 'input' ). Does anyone encounter such an error?

2 Answers

One way I got around this issue was by renaming (or deleting) the coverlet.collector directory in your $HOME\.nuget\packages directory. Close Visual Studio completely, then re-open your solution or project.

File Explorer with renamed coverlet.collector directory

Coverlet has some limitations. It only supports SDK-style projects and in some cases only .NET Core test projects. This is not an issue if you start a new test project in a solution because you can mix up project types.

But migration of an existing old test project to an SDK style .NET Core project could be necessary.

https://github.com/coverlet-coverage/coverlet#Quick-Start has more information about the requirements.

Related