-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Coould not run xunit tests for two frameworks in one project #7245
Comments
Same. .NET Command Line Tools (1.0.0-preview4-004124) Product Information: Runtime Environment: |
I've added these two lines and it started working <OutputType>Exe</OutputType>
<RuntimeIdentifier>win7-x64</RuntimeIdentifier> |
@Faizan2304 can you take a look? |
For me, Migration should add this when migrating a |
Before having migration add it, I want to make sure that this is the expected contract for test projects and not a bug that is ligering there. @Faizan2304 @codito can you guys help us understand this? |
@livarcocc the observation is correct. For netcoreapp1.x a test project should have For multitargeted test projects, the OutputType could be under a conditional. E.g. |
Where is this coming from? Sounds like an unnecessary complication from the point of view of the csproj. People will start with one TFM and then when they add a second, they should just have to add the TFM and nothing more. Today, when they add a full framework, they need to add at least one RuntimeIdentifier, but I know that the folks in the SDK repo are trying to get rid of this requirement over there. Isn't this something that we can do here as well? |
+1. We will fix the Microsoft.NET.Test.Sdk package to take care of conditional OutputType. |
I had the same issue, and this fixed it but now when I run, no tests are detected (this is with Nunit though). Tests were running before I did the migrate to preview3 |
@nambrose nunit tests should run for desktop targets (net4x). I think nunit-vs-adapter doesn't support netcoreapp yet (see nunit/nunit3-vs-adapter#242). Can you share the test project csproj? |
Sorry this took me a bit (it's my evening project) the test project Exe 1.1.0 netcoreapp1.1 portable unittestcore $(PackageTargetFallback);netcoreapp1.1;portable-net45+win8 1.1.0 1.0.0-alpha-20161104-2 All 3.5.0 3.4.0-beta-3 15.0.0-preview-20161024-02 {A70A8D16-4EC9-4EE8-BD7D-742BBA9C81EC} coreand the library it is testing netstandard1.6 portable core 1.0.0-alpha-20161104-2 All 1.6.1 $(DefineConstants);RELEASE |
@codito I checked out the linked issue (thanks) and looks like I am SOL for now (irritating but not a huge deal and looks like the NUnit people also are in the dark) I'll go back to finding out why my project works in VSCode but gets a 500 error in VS now I guess :) Feels a bit like I am in the wild west on Mac but I like the general direction (it's where I would have loved .NET to start out from the beginning) |
I have a test project with two frameworks: net451 and netcoreapp1.0. And I want to run the tests on Windows and Linux. If I want to run the tests on Windows+netcoreapp1.0 - I don't need to add any RuntimeIdentifiers. It works fine But for Windows+net451 I have to add RuntimeIdentifier. But I could add only this line
For Linux + netcoreapp1.0 I have to remove For Linux + net451 it it not possible to build and test project at the moment. Environment data.NET Command Line Tools (1.0.0-preview4-004233) Product Information: Runtime Environment: |
you can use an msbuild Condition so that the RuntimeIdentifier is different for each tfm |
As of 87e9815, Please try build/test with latest dotnet-cli dev build. |
@codito Good, the first bug was fixed. But I still have to declare the different RuntimeIdentifiers for both frameworks, like this
|
@alexvaluyskiy is there an error if RID is not specified for this scenario? Assume this test project is a |
@codito @alexvaluyskiy it looks like this issue is not getting traction. Can you confirm that this will be understood in the next few days? Otherwise we'll need to leave it out of the 1.0 release. We need a fix early next week. |
I think the bug is fixed in rc3. In the previous version I had to add these lines to each test project <OutputType Condition=" '$(TargetFramework)' == 'netcoreapp1.0' ">Exe</OutputType>
<RuntimeIdentifiers>win7-x64;win7-x86;osx.10.10-x64;osx.10.11-x64;ubuntu.14.04-x64;ubuntu.16.04-x64;centos.7-x64;rhel.7.2-x64;debian.8-x64;fedora.23-x64;opensuse.13.2-x64</RuntimeIdentifiers>
<RuntimeIdentifier Condition=" '$(TargetFramework)' == 'net451' ">win7-x64</RuntimeIdentifier> |
Confirmed with @dotnet/vstest and confirmed that this is fixed. |
Steps to reproduce
I have this csproj
Expected behavior
dotnet test --framework net46
dotnet test --framework netcoreapp1.0
Actual behavior
dotnet test --framework net46 - works fine
dotnet test --framework netcoreapp1.0 - does not work. I got an error
Environment data
.NET Command Line Tools (1.0.0-preview4-004123)
Product Information:
Version: 1.0.0-preview4-004123
Commit SHA-1 hash: 3a3ab7e
Runtime Environment:
OS Name: Windows
OS Version: 10.0.14393
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\1.0.0-preview4-004123
The text was updated successfully, but these errors were encountered: