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

Run package manager commands on chosen startup project instead of command line chosen project #23957

Closed
mirza-developer opened this issue Jan 25, 2021 · 6 comments

Comments

@mirza-developer
Copy link

I have 4 projects in a solution and one of them is a .net core class library in .net 5 that we want to add models and data working classes there.
A .net 5 web api is our startup project but because of adding our database to the class library, we must run commands like add-migration on this project.
When we run commands, package manager console raises an error that there is no context in your project.
If the class library be chosen as startup project, command runs correctly.
This issue #23853 is similar to mine

@ajcvickers
Copy link
Contributor

@mirza-developer Are you choosing the target project in the Package Manager Console?

image

@mirza-developer
Copy link
Author

mirza-developer commented Feb 2, 2021

@ajcvickers Target project of console is selected truly

@mirza-developer
Copy link
Author

Also my repository is available on https://github.com/mirza-developer/SurZor

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 2, 2021

What commands do you run? Give an example.

@mirza-developer
Copy link
Author

@ErikEJ add-migration AddSurveyFields

@ajcvickers
Copy link
Contributor

@mirza-developer With your solution if I set the Api as the startup project and your data library as the Package Manager project, then add-migration works for me:

image

@ajcvickers ajcvickers reopened this Oct 16, 2022
@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale Oct 16, 2022
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