c# - How can I setunset an environment variable in VS Code, so that it will take effect for xUnit test runs? - Stack Overflow

admin2025-04-17  2

In my test suite, I'm dynamically skipping tests based on the presence of an environment variable called ASSSETGOV_TEST_MANUAL. This is a common pattern used to skip tests that should only be run manually:

Assert.SkipUnless(Environment.GetEnvironmentVariable("ASSETGOV_TEST_MANUAL") is not null, "ASSETGOV_TEST_MANUAL is not set");

If I run these tests using dotnet test, I can easily set the environment variable on the command line:

ASSETGOV_TEST_MANUAL= dotnet test

How can I set/unset this environment variable in VS Code after it has started, so I can enable/disable these tests?

转载请注明原文地址:http://anycun.com/QandA/1744896956a89165.html