OmniSharp / generator-aspnet

yo generator for ASP.NET Core
877 stars 168 forks source link

Can't restore packages of Unit test project #68

Closed joaomoreno closed 9 years ago

joaomoreno commented 9 years ago

In the following session, I generate a unit test project and run kpm restore. It fails to locate xunit.runner.kre.

➜  Desktop  yo aspnet
...
? What type of application do you want to create? Unit test project
? What's the name of your ASP.NET application? UnitTest

     info ... Fetching https://github.com/OmniSharp/generator-aspnet/archive/release.tar.gz ...
     info This might take a few moments
....
✔ Done in /Users/joao/.cache/yeoman/OmniSharp/generator-aspnet/release

   create UnitTest/SampleTest.cs
   create UnitTest/project.json
/Users/joao/.cache/yeoman

Your project is now created, you can use the following commands to get going
    kpm restore
    kpm build
    k run for console projects
    k kestrel or k webfor web projects

➜  Desktop  cd UnitTest
➜  UnitTest  kpm restore
Restoring packages for /Users/joao/Desktop/UnitTest/project.json
  CACHE https://www.nuget.org/api/v2/FindPackagesById()?Id='xunit.runner.kre'
Resolving complete, 86ms elapsed
Unable to locate xunit.runner.kre >= 1.0.0-beta1
Restore complete, 89ms elapsed
joaomoreno commented 9 years ago

If I replace "xunit.runner.kre": "1.0.0-beta1-*" with "Xunit.KRunner": "1.0.0-beta1" and add a specific NuGet.Config file, then it works.

I figured this out by mimicking what is done in omnisharp-roslyn.

sayedihashimi commented 9 years ago

xunit is not on nuget.org yet that's why you are running into this. We should probably disable the unit test template in the generators.

bradwilson commented 9 years ago

@sayedihashimi: Sorry, your information is incorrect.

xunit.runner.kre was never an officially supported runner. If you want current instructions on how to use xUnit.net inside ASP.NET v5, please see our documentation: http://xunit.github.io/docs/getting-started-aspnet.html

Also, there is no need to have special NuGet.config files for this process. Everything that's required is on nuget.org.

sayedihashimi commented 9 years ago

We have updated the unit test template. This should no longer be an issue, closing.

joaomoreno commented 9 years ago

@sayedihashimi The unit test template simply disappeared. What do you mean by "updated the unit test template"?

sayedihashimi commented 9 years ago

We released an update to the generators a few days back, did you update?

peterblazejewicz commented 9 years ago

@sayedihashimi I think @joaomoreno is correct, we need to take a closer look: https://github.com/OmniSharp/generator-aspnet/blob/master/app/index.js#L44-L47

sayedihashimi commented 9 years ago

Sorry about that. We have a PR for the unit test feature open at #78. I just replied there. I tried the template on OSX and received the following errors on kpm build and k test

  Unable to resolve dependency framework/System.XML

Build succeeded.
    0 Warnings(s)
    0 Error(s)

Time elapsed 00:00:01.0898924
Sayeds-MacBook-Pro:UnitTest sayedhashimi$ k test
System.InvalidOperationException: Failed to resolve the following dependencies for target framework 'Asp.Net,Version=v5.0':
   framework/System.XML

Searched Locations:
  /Users/sayedhashimi/temp/{name}/project.json
  /Users/sayedhashimi/.k/packages/{name}/{version}/{name}.nuspec
  /usr/local/Cellar/mono/3.8.0/lib/mono/4.5/{name}.dll
  /usr/local/Cellar/mono/3.8.0/lib/mono/4.5/Facades/{name}.dll

Try running 'kpm restore'.

  at Microsoft.Framework.Runtime.DefaultHost.GetEntryPoint (System.String applicationName) [0x00000] in <filename unknown>:0
  at Microsoft.Framework.ApplicationHost.Program.ExecuteMain (Microsoft.Framework.Runtime.DefaultHost host, System.String applicationName, System.String[] args) [0x00000] in <filename unknown>:0
  at Microsoft.Framework.ApplicationHost.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0
sayedihashimi commented 9 years ago

We will have a new template soon, see #165. I'll close this now.