dotnet.exe test command file reference fails MSTest

0

I have a ASP.NET Core Web API / .NET Core application running that builds and executes tests locally and on other developer machines. It also runs fine in Docker (we build/test application prior to building docker). We are trying to automate our builds using Visual Studio Team Services and the solution builds fine, it is when it executes the tests on VSTS there is an issue. The application is loading assemblies at run time that it reads from the configuration file, thus when the application tries to load the assembly, it throws an exception (below) saying it cannot be found. The values in the configuration file are relative paths. Anything obvious that I am missing

System.Exception with message "Unable to load assembly or type. A: R:\agent\_work\4\s\Support\<assemblyname>, T: <TypeName>. Error: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)

When the application runs from Visual Studio, it runs fine. When I run the below command, I can recreate the error we get on VSTS.

"C:\Program Files\dotnet\dotnet.exe" test <Project Directory>/project.json --configuration release

Any help determining the proper way to reference these files would be much appreciated.

  • Developer Environment: Visual Studio 2015 Update 3
  • Testing Framework: mstest
  • "MSTest.TestFramework": "1.0.4-preview"
  • "dotnet-test-mstest": "1.1.1-preview"

UPDATE 2/22/17 I am still unable to run the build from VSTS. When I run the command "dotnet.exe test" from a command line that is sourced at the folder of the Test Project, I am able to run the projects.

When I change the path to exclude the ".", I still have the error locally and on VSTS. I have updated the project to reflect this. Below are my build definition:

  1. .NET Core - Restore
    • Project: **/project.json
  2. .NET Core - Build
    • Project: **/project.json
  3. .NET Core - Test
    • Project: test/HostConsoleAppTest/project.json (I also used the relative path)

VSTS Errors:

2017-02-22T17:32:01.3057263Z Unable to load assembly or type. A: D:\a\1\s\Support\ImplAssembly.dll, T: ImplAssembly.TestReference. Error: The system cannot find the path specified. (Exception from HRESULT: 0x80070003) Running the reference with no dot

2017-02-22T17:32:01.3057263Z Getting Configuration

2017-02-22T17:32:01.3057263Z Creating implementation via assembly

2017-02-22T17:32:01.3057263Z Unable to load assembly or type. A: D:\Support\ImplAssembly.dll, T: ImplAssembly.TestReference. Error: The system cannot find the path specified. (Exception from HRESULT: 0x80070003)

Git Repo has been updated

visual-studio-2015
.net-core
mstest
azure-pipelines
asp.net-core-webapi
asked on Stack Overflow Feb 14, 2017 by J Shewchuk • edited Feb 23, 2017 by J Shewchuk

1 Answer

0

I reproduced your issue at my side and you can use "Command Line" task as a workaround for now: enter image description here enter image description here

answered on Stack Overflow Feb 17, 2017 by Eddie Chen - MSFT • edited Feb 23, 2017 by Eddie Chen - MSFT

User contributions licensed under CC BY-SA 3.0