testfx icon indicating copy to clipboard operation
testfx copied to clipboard

DeploymentItem path in .NET Core/Linux

Open ransagy opened this issue 6 years ago • 2 comments

Description

Trying to use [DeploymentItem("..\..\File.zip"] - relative path outside the current test class' path - On both Windows and Linux in .NET Core 3.0 leads to errors in either one or both.

Steps to reproduce

Create a new .NET Core 3.0 Unit Test project with MSTest 2.0 (adapter and framework). Add an [DeploymentItem] attribute with a relative path OUTSIDE/UPWARDS of the unit test project location.

Expected behavior

The item to be deployed exists in the runtime/working folder of the unit test project.

Actual behavior

Using backslash notation: Windows works, Linux fails to find the item, emitting a warning. Using slash notation: Both fail to find the item (and the warning makes it seems like it ignored the given path and is looking for the item in bin/debug or whatever equiv configuration is used).

Environment

MSTest 2.0 adapter and framework, NET Core 3.0.101.

  1. Windows 10 1909, VS19 Preview 16.4
  2. CentOS 7 on WSL (Ubunutu and Debian show the same), VSCode 1.40.2 (Remote WSL execution) or dotnet cli via bash.

ransagy avatar Dec 01 '19 17:12 ransagy

Hmm seeing this issue with latest mstest version still, had this really not been resolved? @ransagny did you find a solution?

nietras avatar Mar 02 '22 10:03 nietras

@nietras As far as i can tell in our codebase, we don't have any more of these - only relative paths to sub-directories, which seems to work fine, so our solution was to just use something else, sadly.

ransagy avatar Mar 02 '22 10:03 ransagy

Closing this issue as it is duplicated by #1460.

Evangelink avatar Dec 07 '23 07:12 Evangelink