■ はじめに
単体試験実行中に 以下の「エラー内容」が発生した
■ エラー内容
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices\v4.0_14.0.0.0__b03f5f7f11d50a3a'.
https://github.com/axodox/AxoCover/issues/176
■ 発生環境
- OS : Windows10
- .NET : .NET4.5
- Visual Studio : Visual Studio 2017
- 言語 : C#
- その他 : カバレッジツール AxoCover
■ 対策案
- 指定されたフォルダパスを手作業で作成
- フォルダのアクセス権限をフルアクセスにする
詳細
System.IO.DirectoryNotFoundException で 「ディレクトリが見つからない」って言ってるので 指定されているパスを見たら、 「'C:\WINDOWS\Microsoft.Net\assembly\」までは存在しており 以降の「Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices\v4.0_14.0.0.0__b03f5f7f11d50a3a」 がなかった。 「Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices」と 「v4.0_14.0.0.0__b03f5f7f11d50a3a」を手作業でフォルダ作成した。 それで、実行したら今度は、UnauthorizedAccessException例外が発生した。 ~~~~~~~ UnauthorizedAccessException パス 'C:\WINDOWS\Microsoft.Net\assembly\GAC_32\Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices\v4.0_14.0.0.0__b03f5f7f11d50a3a' へのアクセスが拒否されました ~~~~~~~ なので、フォルダ「v4.0_14.0.0.0__b03f5f7f11d50a3a」のアクセス権限を フルアクセスにして、再度、単体試験を実行したら、うまくいった
関連記事
【C#】カバレッジツール / AxoCover ~ 初期設定編 ~
https://dk521123.hatenablog.com/entry/35768291