question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Automatically detect runsettings specified in a build property

See original GitHub issue

Description

The Testwindow in Visual Studio detects a runsettings file specified in the build property RunSettingsFilePath for a project (c#, f#, and c++), but vstest currently doesn’t mimic this functionality.

Steps to reproduce

  1. add the following to the .csproj of a test project
<PropertyGroup>
    <RunSettingsFilePath>[path to a .runsettings file]</RunSettingsFilePath>
</PropertyGroup>
  1. run the tests in the project using the cli

Expected behavior

run settings defined in the specified file should be used

Actual behavior

They are currently not applied

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:18 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
vritant24commented, Mar 11, 2020

@CodeChief thanks for your response.

The link to the documentation is https://aka.ms/vs-runsettings (https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?branch=release-16.4&view=vs-2019#visual-studio-2019-version-164-and-later specifically) and walks through how to set up auto detection with either with a solution wide “.runsettings” file or one that is specified in the build properties of a project. Please let me know if anything there is unclear and can be improved…

Instead of using $(ProjectDir), we recommend using $(MSBuildProjectDirectory) (docs). I’ll update the documentation to point users to the recommended list of properties.

There is a task in the backlog to expose runsettings better in the VS UI, but it is currently lower in priority.

1reaction
ViktorHofercommented, Jan 7, 2020

Closing this issue now. Let me know if someone has any concerns

Closing this issue is fine as it just covers the msbuild property but we should have another tracking issue to enable:

  1. the auto-detection feature (a .runsettings file is searched in the test assembly’s folder)
  2. hook into GetCopyToOutputDirectoryItems to add the $(RunSettingsFilePath) to the AllItemsFullPathWithTargetPath item.
Read more comments on GitHub >

github_iconTop Results From Across the Web

Customizing Code Coverage Analysis - Visual Studio
Starting in Visual Studio 2019 version 16.4, you can autodetect a run settings file in the project root. Otherwise, on the Test menu, ......
Read more >
Ability to set runsettings in project file - Developer Community
Specify a project level runsettings file through the build property `RunSettingsFilePath`. Visual Studio will always use the file in test runs ...
Read more >
Runsettings file in visual studio code
Go into VS Code's settings and search '.runsettings'. This should show the "Omnisharp: Test Run Setting" setting under the Extensions > C# ...
Read more >
Passing parameters to NUnit tests using Azure Pipelines
Under the General section of the Test node, tick the box for “Auto Detect runsettings Files”. Auto Detect runsettings Files in the Options ......
Read more >
ReSharper ignoring/reading wrong runsettings file
I am finding that ReSharper is ignoring the runsettings file selected from the VS menu ( Test > Configure Run Settings > Select...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found