Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet test assumes different output path than dotnet build #5264

Open
DWIAltonaAnalytics opened this issue Sep 4, 2024 · 2 comments
Open

Comments

@DWIAltonaAnalytics
Copy link

Description

in a two step build using

step 1 build:

dotnet build [SolutionPath] --configuration Release --no-restore --verbosity minimal  /property:WarningLevel=0

step 2 test:

dotnet.exe test [ProjectPath] --configuration Release --no-build --no-restore --results-directory [...]\TestResults --settings [...]\coverlet.runsettings --verbosity normal /property:SolutionDir=[SolutionPath]

I get an error that [OutputPathBase]\Release\[ProjectAssemblyName].dll was not found.

which is correct, because it can be found at [OutputPathBase]\x86\Release\[ProjectAssemblyName].dll.

If I use this for building (which is very poorly documented):

dotnet build [SolutionPath] --configuration Release --no-restore --verbosity minimal /property:AppendPlatformToOutputPath=False /property:WarningLevel=0

the test runs without that error as the build produces the output without x86

Steps to reproduce

see above

Expected behavior

dotnet test should not assume plattform/architecture is missing from the outputpath

Actual behavior

without adjusting build, the tests expect the output to be in a different place.

Environment

$> dotnet --version
8.0.401
@DWIAltonaAnalytics
Copy link
Author

Addendum: If I add /property:AppendPlatformToOutputPath=True to the dotnet test call, it searches with plattform AnyCPU without regard to what is configured in the csproj.

@nohwnd
Copy link
Member

nohwnd commented Sep 5, 2024

Can you please build both of the above with binary log?

/bl:dotnet-build.binlog
/bl:dotnet-test.binlog

I don't think we are assuming anything about the output path in dotnet test, we get it from msbuild via TargetPath: https://github.com/microsoft/vstest/blob/main/src/Microsoft.TestPlatform.Build/Microsoft.TestPlatform.targets#L86

If you cannot share your binlog, can you please check what the value of TargetPath is in the build that is handed over to the vstest target linked above? You can do so by producing the binary log and then viewing it via the binary logger viewer: https://msbuildlog.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants