vstest
vstest copied to clipboard
Use executable flags in Microsoft.NET.Test.Sdk
This issue is a follow up to the discussion in https://github.com/dotnet/sdk/pull/1178
We can set following flags for test projects:
-
HasRuntimeOutput = true
to allow generation of deps file -
OutputType = dll
- Remove the logic for auto generation of binding redirects
- Check if we need to add a flag to disable packaging of test projects? Or it comes automatically?
You need Microsoft/msbuild#1310 to be fixed in order to make this change and get binding redirects for a test library.
Changing the milestone as we are blocked on Microsoft/msbuild#1310
Any progress on this issue?
Currently, in a test project targeting .NETFramework, which also uses a nuget package containing native platform dlls, we need to set either HasRuntimeOutput to true, or specify a RuntimeIdentifier of win-x86/x64.
We have nuget package containing native x86 and x64 dlls (located inside runtimes/win-x64/native).
When using this package inside a net48 Exe/WinExe project, we do not need to set 'RuntimeIdentifier' as this is infered from TargetFramework + PlatformTarget.
For a unit test project (which is OutputType=Library), this RuntimeIdentifier is not infered, so during build the native dlls are not copied to the output, resulting in runtime errors.
The unit test project compiles fine, no error or warning is given during build, but due to missing native dlls, this only happens when running the test.
We have to remember to set either HasRuntimeOutput or RuntimeIdentifier in a test project.
For test projects targeting .NETFramework, I think this can be inferred the same way as is done for OutputType Exe/WinExe.