0

I have my dlls for the test project deployed to the server. Now I'm trying to run them using dotnet test "Path to tests.dll" but I get an error:

F:\path\tests.dll(1,1): error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.

Basically it requires csproj file to be there in the same catalog as it was on my local machine. What's the point of having runnable DLLs for testing if I still need csproj to run the tests on the remote server. That doesn't make any sense.

How can I run the tests without having to have csproj file on the server?

T4under4
  • 125
  • 3
  • 13
  • I think that is by design. Depending on the test framework you use, there might be a console runner to do what you need. What are you using as test framework? – PMF Jan 17 '22 at 14:33
  • @PMF I'm using xunit. I wanted to try to run vstest.console.exe instead of dotnet test but unfortunately I don't have permissions to access C drive on the remote server nor there is Visual Studio installed there as it's a server for our apps deployment – T4under4 Jan 17 '22 at 15:21
  • Can't you just copy vstest.console.exe there? I've never tried this with xunit, but if you manage to get it to run locally, you should be able to just copy everything to the remote folder (eventually including the .net runtime) – PMF Jan 17 '22 at 18:20

1 Answers1

0

I found the answer to my problem. In order to run the tests on a remote server through PowerShell, I had to use "dotnet vstest" instead of "dotnet test". vstest command allows running the tests by simply using dll file without the need for csproj file.

T4under4
  • 125
  • 3
  • 13