FineCodeCoverage icon indicating copy to clipboard operation
FineCodeCoverage copied to clipboard

RunSettingsFilePath in csproj

Open Soundman32 opened this issue 3 years ago • 6 comments

Installed product versions

  • Visual Studio: 2022 17.4.2
  • This extension: 1.1.189

Description

Every csproj file gets a local path based RunSettingsFilePath, which ends up getting checked into git and breaks the build.

Steps to recreate

Open solution, build and run tests.

Current behavior

This gets added to every csproj: <RunSettingsFilePath>C:\dev\MyProjectetc\bin\Debug\net6.0\fine-code-coverage\coverage-tool-output\MyProject.UnitTests-fcc-mscodecoverage-generated.runsettings</RunSettingsFilePath>

Expected behavior

csproj files should not be modified when testing.

Soundman32 avatar Dec 14 '22 08:12 Soundman32

When FCC generates the runsettings it is necessary to write to the proj file. FCC does attempt to remove this element.

It is possible to supply your own runsettings. Alternatively you can use Coverlet / OpenCover coverage instead of ms code coverage which does not adjust the csproj file.

tonyhallett avatar Dec 14 '22 08:12 tonyhallett

I'd forgotten I'd enabled the ms code coverage thing. I've turned it off and it now works without updating the csproj.

Soundman32 avatar Dec 14 '22 09:12 Soundman32

There is a difference between ms and 'old style' though. Ms is immediate and collects from the tests you select. Old style runs all tests after the ones you select finish.

I will look at storing the csproj and overwriting with it instead.

tonyhallett avatar Dec 14 '22 09:12 tonyhallett

@tonyhallett, it should use a relative path instead of an absolute one. That way the files can be pushed to git and shared between developers. the autogenerated config should search from the base path of the project with the option to enter an absolute path.

UkeHa avatar Jul 04 '23 11:07 UkeHa

@UkeHa The generated runsettings entry in the csproj file should be deleted. If this was occurring then it would be irrelevant. If someone could specify when it doesn't then I could look at it. Note that this does not happen every time.

https://github.com/FortuneN/FineCodeCoverage/assets/11292998/1405b6eb-f9fa-4513-9976-16f249a9de36

The generated runsettings is generated in your bin folder which is not checked in.

tonyhallett avatar Jul 04 '23 13:07 tonyhallett

@tonyhallett I can see that for the most part the csproj amendment is removed at the end of the test run.

However, I think there must be an edge case somewhere as it does occasionally get left behind - I've seen this a few times across different projects.

As an aside if a test fails (I just threw an exception in there) the setting is not removed (it did get removed once the test passes).

adamhearn avatar Apr 18 '24 06:04 adamhearn

Fix avaiable on marketplace.

tonyhallett avatar Jul 25 '24 13:07 tonyhallett