I am seeking a way to define assembly resolution values using relative file paths.
I am approaching this by defining and referencing an environment variable as recommend by the Microsoft documentation. As you can see from the code snippet below, I have defined an environment variable 'test' and am referencing it in the MSTest Adapter section. Compiling and running the tests with VS produces an error regarding missing reference dependencies.
I have verified this issue is resolved by setting the 'test' value to equal the hard coded directory path. In addition to the value set in the code snippet, I have also tried the following value definitions for 'test' without success:
- $(OutDir)............somepath
- $(MSBuildProjectDirectory)........somepath
<RunConfiguration>
<MaxCpuCount>1</MaxCpuCount>
<!-- Path relative to directory that contains .runsettings file-->
<ResultsDirectory>.TestResults</ResultsDirectory>
<!-- x86 or x64 -->
<!-- You can also change it from the Test menu; choose "Processor Architecture for AnyCPU Projects" -->
<TargetPlatform>x86</TargetPlatform>
<!-- Framework35 | [Framework40] | Framework45 -->
<TargetFrameworkVersion>Framework40</TargetFrameworkVersion>
<!-- Path to Test Adapters -->
<TestAdaptersPaths>%SystemDrive%Tempfoo;%SystemDrive%Tempar</TestAdaptersPaths>
<!-- TestSessionTimeout was introduced in Visual Studio 2017 version 15.5 -->
<!-- Specify timeout in milliseconds. A valid value should be greater than 0 -->
<TestSessionTimeout>10000</TestSessionTimeout>
<!-- true or false -->
<!-- Value that specifies the exit code when no tests are discovered -->
<TreatNoTestsAsError>true</TreatNoTestsAsError>
<EnvironmentVariables>
<!-- List of environment variables we want to set-->
<test>.........somepath</test>
</EnvironmentVariables>
</RunConfiguration>
<MSTest>
<MapInconclusiveToFailed>True</MapInconclusiveToFailed>
<CaptureTraceOutput>false</CaptureTraceOutput>
<DeleteDeploymentDirectoryAfterTestRunIsComplete>False</DeleteDeploymentDirectoryAfterTestRunIsComplete>
<DeploymentEnabled>False</DeploymentEnabled>
<AssemblyResolution>
<Directory path="%test%" includeSubDirectories="false"/>
</AssemblyResolution>
</MSTest>
How can I get the paths to be relative?
question from:
https://stackoverflow.com/questions/65923863/specify-relative-file-paths-with-runsettings-file 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…