Skip to content
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 restore packages.config support #7922

Closed
coffeeneer opened this issue Mar 14, 2017 · 8 comments
Closed

dotnet restore packages.config support #7922

coffeeneer opened this issue Mar 14, 2017 · 8 comments

Comments

@coffeeneer
Copy link

Issue

Situation

Since the dotnet sdk does not support EF6 edmx with code generation I set up a full .net class library project for my domain, which I reference from a asp.net project. In visual studio I added the EntityFramework package with the manage nuget packages interface. This setup the project correctly and the default Visual Studio nuget package restore works fine, with no build errors. Using dotnet restore on the project just tells me there are no packages configured for the project and does not restore the EF package.

From my understanding the dotnet restore command is a driver that uses nuget to restore the packages. But the restore process differs from the nuget restore process.

Attempted fix

Since the packages.config seems to be ignored I tried using tags in the project file. This made dotnet restore recognise the packages, but it could not build correctly due to missing references. It seems the package reference way of including packages does not work with "classic" class libraries.

Workaround

As a workaround I downloaded nuget.exe (4.0) and used ".\nuget.exe restore" on the project which correctly restored all packages.

Steps to reproduce

  1. Have a full framework .net class library project (non-portable, .net v4.5.2, tools version 15.0), add the nuget EntityFramework package.
  2. Delete packages folder in the solution root.
  3. Open cmd or powershell and navigate to the project folder.
  4. Use "dotnet restore".
  5. User "dotnet (ms)build"

Expected behavior

The packages are restored in the same way "nuget.exe restore" would with a recent version of nuget (4.0 supports the tag used in .net core projects) and the project builds succesfully.

Actual behavior

The packages are not recognized by the dotnet cli, it does not restore any package and the "dotnet (ms)build" command fails with reference issues.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.1)

Product Information:
 Version:            1.0.1
 Commit SHA-1 hash:  005db40cd1

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.1
@livarcocc
Copy link
Contributor

dotnet restore does not support packages.config. Only csproj packagereferences.

cc @emgarten to confirm.

@emgarten
Copy link
Member

dotnet restore does not support packages.config. Only csproj packagereferences.

That is correct. We are considering adding packages.config restore support to dotnet restore, but it raises the question, should dotnet restore support projects that dotnet build and other commands do not? @livarcocc do you have any thoughts on the direction this should go?

@coffeeneer
Copy link
Author

So if I understand correctly, what I'm trying to do is just not supported. I want to use EF's entity designer interface (database first), which is not supported in the .net core class library projects (with "net452" set as framework). This crashes when adding the EntityFramework edmx to the project. So I reverted to using a standard class library project. But then not only is the dotnet restore not restoring the packages (missing packages.config support), but also the dotnet msbuild is not executing the EntityDeploy msbuild task.

I'd love having the dotnet cli also build my project's domain class library correctly when building my asp.net core app. That leaves me to the question, is support for this within scope?

On adding the packages.config support: I'd say it is not necessary when the rest of the tool-chain does not benefit from it. If you can't build a project, you don't need packages restored for it.

@livarcocc
Copy link
Contributor

Supporting old style csproj files is not in scope for the CLI.

@bricelam Do we intend to add support to dotnet core to the EF designer interface in VS?

@bricelam
Copy link
Contributor

Not the Entity Framework 6 Tools for Visual Studio, no. But we have dotnet/efcore#1027 about creating a new designer for EF Core.

The two existing EF Core-compatible designers that I know about are:

We've considered adding CPS-based csproj support to the EF6 PMC commands (dotnet/ef6#146), but never to the Designer.

@livarcocc
Copy link
Contributor

@dodedodo33 Like I said, it is not in the plans for the CLI to supported legacy style csproj, so in this case, I would suggest you continue using VS 2017.

@coffeeneer
Copy link
Author

@livarcocc Thanks for clarifying, I've found some work arounds to make it work in my build agent. I'll keep using this environment 'till EF core catches up :)

@kailashrdave
Copy link

kailashrdave commented Feb 15, 2018

@dodedodo33
Thank you for the workaround.
It worked for me after executing

nuget restore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants