jcansdale / TestDriven.Net-Issues

Issue tracking for TestDriven.Net
https://github.com/jcansdale/TestDriven.Net-Issues/issues
24 stars 2 forks source link

Doesn't work: VS2017, csproj, .NET Core 1.1.1 #96

Closed grokky1 closed 5 years ago

grokky1 commented 7 years ago

This is what I have:

My csproj has this:

<PropertyGroup>
  <TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>

<ItemGroup>
  <PackageReference Include="Microsoft.DotNet.InternalAbstractions" Version="1.0.1-beta-003206" />
  <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.0.0" />
  <PackageReference Include="NUnit" Version="3.6.1" />
  <PackageReference Include="NUnit3TestAdapter" Version="3.8.0-alpha1" />
</ItemGroup>

When I try run tests using TD, it builds, then when the testing starts, it throws this:

------ Test started: Assembly: Foo.Bar.Tests.dll ------

Unknown .NET Framework Version: v1.1
Test '' failed: Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified.
    System.IO.FileNotFoundException: Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified.
    File name: 'nunit.framework'
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
    at System.Activator.CreateInstance(String assemblyString, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo, StackCrawlMark& stackMark)
    at System.Activator.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)
    at System.AppDomain.CreateInstance(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
    at System.AppDomain.CreateInstanceAndUnwrap(String assemblyName, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityAttributes)
    at NUnit.Engine.Drivers.NUnit3FrameworkDriver.Load(String testAssemblyPath, IDictionary`2 settings)
    at NUnit.Engine.Runners.DirectTestRunner.LoadPackage()
    at NUnit.Engine.Runners.AbstractTestRunner.Load()
    at NUnit.Engine.Runners.MasterTestRunner.LoadPackage()
    at NUnit.Engine.Runners.MasterTestRunner..ctor(IServiceLocator services, TestPackage package)
    at NUnit.Engine.TestEngine.GetRunner(TestPackage package)
    at NUnitTDNet.Adapter.EngineTestRunner.run(ITestListener testListener, Assembly testAssembly, String where)
    at NUnitTDNet.Adapter.EngineTestRunner.RunAssembly(ITestListener testListener, Assembly assembly)
    at TestDriven.TestRunner.AdaptorTestRunner.Run(ITestListener testListener, ITraceListener traceListener, String assemblyPath, String testPath)
    at TestDriven.TestRunner.ThreadTestRunner.Runner.Run()

0 passed, 1 failed, 0 skipped, took 1.15 seconds (NUnit 3.x).

Why is it looking for .NET framework? Surely it should use .NET Core, and use the latest version 1.1.2?

jcansdale commented 7 years ago

I'm afraid it doesn't currently work with .NET Core in VS 2017. 😒

Since I'm not actively using .NET Core and it will likely involve some big changes, I'm not sure when I'll be able to get this working. Post .NET Core 2.0 things are likely to be more stable, so I'll have another look then.

Regards, Jamie.

grokky1 commented 7 years ago

@jcansdale I want to cry too. 😭

If I knew that TD doesn't work in VS2017, I might not have upgraded - I've become totally dependent on it.

BTW, all the rapid changes in .NET Core have ended. NUnit, xUnit, MSTest, etc., are all working now. So if you can't update TD to Core because of time constraints, that's fine, but on the other hand, don't wait for Core 2.0 because that's unnecessary.

jcansdale commented 7 years ago

If I knew that TD doesn't work in VS2017, I might not have upgraded - I've become totally dependent on it.

It all became pretty sketchy. I'd update VS2017 with the new .NET Core support and the legacy .NET Core support in VS2015 would break. That wasn't terribly conducive to getting it working with the new version.

It's good to know the rapid changes have ended now. I'll certainly certainly take another look. Alas I do have other commitments as well, so don't hold you breath!

grokky1 commented 7 years ago

@jcansdale I most certainly WILL hold my breath - like I said TD makes testing pleasant. Without it we're stuck with the suckiness of the VS "Test Explorer" monstrosity. πŸ˜†

Yeah all those changes were crazy. And there are still so many things they haven't completed! I think the test-related stuff is finalised, but then again I'm no expert. The NUnit guys seem to have gotten it right, I think.

grokky1 commented 7 years ago

@jcansdale netstandard/core 2.0 are released. Hmm... πŸ˜† πŸ˜†

jcansdale commented 7 years ago

I haven't forgotten and I do really want to add .NET Core 2.0 support. It's just work and family commitments have made it really hard recently.

Have you tried the .NET Core support in NCrunch? I know @remcomulder has been doing a great job battling with .NET Core and Visual Studio. http://blog.ncrunch.net/post/NET-Core-Support-Has-Arrived!.aspx

BTW, my day job is working on the GitHub for Visual Studio extension (if you'd like to give it a try): https://github.com/github/VisualStudio/releases

grokky1 commented 7 years ago

NCrunch: I don't use it unfortunately. That blog post makes it sound like a lot of effort, but take into account they were updating NCrunch as Core was developing. You went the "sane" approach (this is MS after all!) and waited for version 2.0. The dust has settled by now... I hope! πŸ˜†

VS extension: hey cool! Never knew about it.

remcomulder commented 7 years ago

Supporting .NET Core in NCrunch prior to v2.0 has not been my favourite life choice. Beware the settling of dust, I've been fooled by this before :(

grokky1 commented 7 years ago

@remcomulder Yes that's MS for you! v1 always sucks, v2 is what v1 should have been (i.e. not a beta)... πŸ˜„

jcansdale commented 7 years ago

You went the "sane" approach (this is MS after all!) and waited for version 2.0. The dust has settled by now... I hope! πŸ˜†

Actually, like @remcomulder I started with the less than sane approach and had it working with .NET Core 1.0/1.1 and project.json (for a while). The transition from project.json to .csproj was particularly unpleasant for integrators. I was used to some pretty flaky CTP versions of Visual Studio, but this was nasty. πŸ˜‰

@grokky1 You should give NCrunch a try. I use it when developing TestDriven.Net. They surprisingly don't tread on each others toes (due to their different interfaces).

jcansdale commented 5 years ago

@grokky1 I've finally .NET Core support working with Visual Studio 2017. You can find an experimental build here https://github.com/jcansdale/TestDriven.Net-Issues/issues/106#issuecomment-452926516.

I'll be tracking .NET Core support in #106, so closing this issue.