これは最も奇妙なことです。複数のクラスライブラリプロジェクト(すべて.Net Framework 4.7)と、それらのクラスライブラリをテストするための複数の単体テストプロジェクトを含むソリューションがあります。たまに、NuGetパッケージをアップグレードして最新の状態に保ちます。これらのアップグレードの一部では、app.configファイルがテストプロジェクトに導入されます。そのapp.configが導入されると、テストはVisual Studioによって検出されなくなるため、ビルドごとに実行されなくなります。失敗したテストがコードを修正するトリガーであると考えると、これにより、単体テストに失敗したコードを導入するシナリオが作成されましたが、自動化に大きく依存していたため、成功したと想定しました。
要約すると、-app.configが存在すると、app.configが完全に空であっても、VS2017はapp.configを含むプロジェクト内のテストを検出しません。構成ファイルを削除するだけで、VS2017はテストを再検出します-ソリューション内のすべてが.Net Framework 4.7を対象としています-MsTestアダプターとTestFrameworkを含むすべてのNugetパッケージが更新されます-app.configファイルは、たとえば、アセンブリバインディングエントリのみで埋められます:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Net.Http" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.2" newVersion="4.1.1.2" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.RuntimeInformation" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.1.0" newVersion="4.0.1.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
加害者を見つけました。他の誰かがこれに遭遇した場合に備えて共有したいと思いました。System.Runtime NuGetパッケージをテストプロジェクトに追加した後、テストはVS2017によって検出されました。
この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。
侵害の場合は、連絡してください[email protected]
コメントを追加