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

Auto-add new projects to solution if one is present #8118

Open
dhasenan opened this issue Apr 16, 2017 · 2 comments
Open

Auto-add new projects to solution if one is present #8118

dhasenan opened this issue Apr 16, 2017 · 2 comments

Comments

@dhasenan
Copy link

When you create a project in a directory with a solution, you would expect the project to be added to the solution, because 99% of the time you'll only have one solution and all projects should belong to the solution.

If there are multiple solution files, a warning should be emitted informing the user that they should manually add the project to the desired solutions using dotnet sln [solution file] add [project file].

Steps to reproduce

mkdir foo
cd foo
dotnet new sln --name MySolution
dotnet new console --name MyConsoleApp
dotnet restore

Expected behavior

  Restoring packages for /home/dhasenan/Projects/foo/MyConsoleApp/MyConsoleApp.csproj...
  Generating MSBuild file /home/dhasenan/Projects/foo/MyConsoleApp/obj/MyConsoleApp.csproj.nuget.g.props.
  Generating MSBuild file /home/dhasenan/Projects/foo/MyConsoleApp/obj/MyConsoleApp.csproj.nuget.g.targets.
  Writing lock file to disk. Path: /home/dhasenan/Projects/foo/MyConsoleApp/obj/project.assets.json
  Restore completed in 362.23 ms for /home/dhasenan/Projects/foo/MyConsoleApp/MyConsoleApp.csproj.
  
  NuGet Config files used:
      /home/dhasenan/.nuget/NuGet/NuGet.Config
  
  Feeds used:
      https://api.nuget.org/v3/index.json

Actual behavior

/usr/share/dotnet/sdk/1.0.1/NuGet.targets(97,5): warning : Unable to find a project to restore! [/home/dhasenan/Projects/foo/MySolution.sln]

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:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/1.0.1
@livarcocc
Copy link
Contributor

@richlander to discuss the experience here.

@mlorbetske as this probably would have to happen in the template engine.

I am not sure this is the right thing to do by default. Maybe we add a flag that let's you say add to sln file. Or it also accepts a path to an sln file. But then, what happens when a sln file does not exist and you use the flag, should it fail? Warn?

@msftgits msftgits transferred this issue from dotnet/cli Jan 31, 2020
@msftgits msftgits added this to the Backlog milestone Jan 31, 2020
Copy link
Contributor

Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.

@github-actions github-actions bot added the stale label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants