相対ファイル パスを使用してアセンブリ解決値を定義する方法を探しています。
Microsoft のドキュメントで推奨されているように、環境変数を定義して参照することで、これに取り組んでいます。以下のコード スニペットからわかるように、環境変数 'test' を定義し、MSTest アダプター セクションで参照しています。VS でテストをコンパイルして実行すると、参照依存関係の欠落に関するエラーが発生します。
「test」値をハードコードされたディレクトリ パスに設定することで、この問題が解決されることを確認しました。コード スニペットで設定された値に加えて、次の「test」の値の定義も試しましたが、成功しませんでした。
- $(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>
パスを相対的にするにはどうすればよいですか?