I wrote a very simple C# .Net Framework application and added some unit tests. Now, trying 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?

3

There are 3 answers

0
Marcel Melzig On

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.

0
Edward J. Stembler On

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

0
Dieter V On

I resolved this by using .Net6 for my test project rather than .Net 4.x . the .Net6 library was still able to execute my functions in my .net4.x library and coverlet restored without any issues