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)............\some\path\
- $(MSBuildProjectDirectory)........\some\path\
<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%\Temp\foo;%SystemDrive%\Temp\bar</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>.\..\..\..\..\some\path\</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?