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

Restore operation should not be required for newly created projects #7905

Closed
dsplaisted opened this issue Mar 11, 2017 · 4 comments
Closed
Assignees
Labels
Milestone

Comments

@dsplaisted
Copy link
Member

When you create a new project (ie via dotnet new console), you currently have to run dotnet restore before running other commands such as build, run, or publish.

This issue is to make it unnecessary to explicitly run dotnet restore after creating a new project via dotnet new.

Possible ways of achieving this include implicitly running a restore operation after creating the project, or having the template include a pregenerated assets file.

@svick
Copy link
Contributor

svick commented Mar 11, 2017

As long as running dotnet restore is required before building a changed project, doesn't it make sense to require it for newly created projects too, to teach users about it?

I imagine the current workflow (assuming #918 is fixed) of creating a project, building it, modifying it and then building it again goes something like this:

  1. Run dotnet new.
  2. Run dotnet build, get an error message explaining you need restore.
  3. Run dotnet restore and then dotnet build.
  4. Edit the project file and source code.
  5. Run dotnet restore and then dotnet build, because you remember it from step 3.

With this proposed change, I think it would go like this:

  1. Run dotnet new.
  2. Run dotnet build successfully.
  3. Edit the project file and source code.
  4. Run dotnet build, get a confusing error message about missing namespace, or similar.
  5. ???

The new workflow, while it looks simpler at first, has no good place to teach users that dotnet restore is necessary, so I think it's overall worse.

I would like it if dotnet build ran dotnet restore automatically if necessary, but that's a different discussion (https://github.com/dotnet/cli/issues/1742, https://github.com/dotnet/cli/issues/1334, NuGet/Home#4329).

@dasMulli
Copy link
Contributor

The templating engine added support for PostActions recently so templates can potentially execute a restore after creation: dotnet/templating#234

Note that this needs to be decided on a per-template basis as dotnet new lib would benefit from a restore but dotnet new solution and dotnet new nugetconfig would not.

@livarcocc
Copy link
Contributor

@svick This is a stepping stone. Eventually, we would like to run restore behind the scenes not only for new, but for any command that requires it. This issue is simply tracking the first turn of the crank on this.

@livarcocc livarcocc self-assigned this Mar 14, 2017
@livarcocc
Copy link
Contributor

We will track our piece of the work for new/run here: https://github.com/dotnet/cli/issues/6100.

I will create a separate issue for running restore implicitly on other commands.

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the 2.0.0 milestone Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants