-
Notifications
You must be signed in to change notification settings - Fork 326
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
does not work for projects with custom output path
#445
Comments
@livarcocc and I hit this last week in the https://github.com/dotnet/sdk when trying to port their tests to |
This is actually not a test SDK issue. @alecor191 is actually hitting dotnet/sdk#802. @livarcocc and I hit the same thing. That issue causes the targets included in the test SDK nuget packages to not get picked up, and thereby the Main method to not get generated [amongst other issues]. I think this is something that the in-box test components may be able to check for and provide some diagnosability, though I'm not sure if that's necessary once dotnet/sdk#802 is fixed. I'll leave it to the team to decide once they have a chance to think through the issue. |
I've the same issue when using Error message is like:
The csproj looks like: <Project Sdk="Microsoft.NET.Sdk">
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<ProjectReference Include="..\..\src\SimMetrics.Net\SimMetrics.Net.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="NFluent" Version="2.0.0-alpha" />
<PackageReference Include="NUnit" Version="3.6.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.7.0" />
</ItemGroup>
</Project> |
@StefH I have the exact same problem. Did you figure this out? |
@StefH @jaymedavis does test project output path contain any |
I'm also experiencing the same issue with xunit on osx.
fsproj:
|
I am using xunit as well. I believe the issue is it's looking at the x86 version of the sdk. I only installed the 64bit version originally. When I installed the x86 sdk, that took care of it. I did a lot of things working on this problem yesterday, so let me know if this solves it 👍 |
I think
@TheAngryByrd |
With some debug flags turned on:
And the output of the build
|
@TheAngryByrd I believe your issue on osx is net452 doesn't exist there. You should only target netcoreapp1.1, as that's compatible with your mac |
Figured it's some mono issue. I can get it to build with mono with this https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-1.0.1#using-net-framework-as-targets-framework-the-osxunix-build-fails just fine, but can't run the tests. |
For sake of completion. I also get this error:
I'd be willing to look into making this work for mono. Any pointers you have would be appreciated. cc: @nosami @mrward |
@TheAngryByrd the adapters are correctly getting copied to output directory. This error is coming because Possibly Created #679 to track support running tests on mono. Update: added observations on ubuntu with mono in #679 (comment). |
Closing this issue since mono support is tracked in #679. |
@codito, the error is not mono specific, why did you close it due to mono support? |
Yeah I shouldn't have hijacked this thread, similar error message different cause. |
@michael-freidgeim-webjet my bad, reopening it. Thanks for correcting me. |
@alecor191 The issue is with msbuild and sdk and here is the solution of your problem dotnet/sdk#980 (comment) You have to update your csproj similar like <Project >
<PropertyGroup>
<BaseIntermediateOutputPath>..\..\artifacts\obj\$(MSBuildProjectName)\$(Configuration)\$(ProcessorArchitecture)\</BaseIntermediateOutputPath>
<OutputPath>..\..\artifacts\test\$(MSBuildProjectName)\$(Configuration)\$(ProcessorArchitecture)\</OutputPath>
</PropertyGroup>
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
<PackageReference Include="xunit" Version="2.2.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.2.0" />
</ItemGroup>
<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
</Project> |
@StefH the issue is with the Nunit nuget package |
@michael-freidgeim-webjet Please do let me know if your issue is not getting resolve with above two comment. |
For my MSTest project (.NETFramework,Version=v4.6.1)
I was able to successfully run the tests after installing:
|
@michael-freidgeim-webjet : Did you tried command in this order
|
@Faizan2304 Why was this closed? The OP reported this issue using the xunit runner. And, I've tried the latest preview, |
@MiYanni I tried the repro steps mentioned in the original issue filed . It seems to be working as expected.
I was able to run the tests with both VS IDE and dotnet test verb. Can you please confirm ? VS version : 15.9.4 |
@singhsarab At the time that I commented on this, I was working on our build process for Azure PowerShell related to using Azure DevOps. I had tried a lot of different ways to modify our build. Unfortunately, I didn't even put enough context for myself to understand what I was referring to. That said, I simply modified our test projects' output folder. I ran our build and it worked appropriately. For now, I'd close this issue. If I get back to modifying our process and run into this again, I'd give more details. |
Thanks @MiYanni I am closing this issue. |
Moved from https://github.com/dotnet/cli/issues/5582 on behalf of @alecor191
Steps to reproduce
dotnet test
Expected behavior
Both VS2017 IDE and
dotnet test
should execute the XUnit tests in the test project.Actual behavior
VS2017 IDE is able to execute the tests successfully. However,
dotnet test
fails with the following warning:Warning: The path '[...]\artifacts\test\<test_project_name>\Debug\net461' specified in the 'TestAdapterPath' does not contain any test adapters, provide a valid path and try again.
Additional info
I noticed the following:
dotnet test
fails as I can't findxunit.runner.visualstudio
assemblies in the output path (xunit.runner.visualstudio.testadapter.dll is missing).<BaseIntermediateOutputPath>
and<OutputPath>
from the .csproj file, thendotnet test
succeeds. In fact, I see in the defaultbin
directory the files fromxunit.runner.visualstudio
package (xunit.runner.visualstudio.testadapter.dll).Environment data
dotnet --info
output:.NET Command Line Tools (1.0.0-rc3-004530)
Product Information:
Version: 1.0.0-rc3-004530
Commit SHA-1 hash: 0de3338607
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-rc3-004530
The text was updated successfully, but these errors were encountered: