I've created a Asp.Net Core project using Yeoman Generator using yo aspnet
but the project can't be run.
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.
Please do the following thing:
npm uninstall -g generator-aspnet
npm install -g yo bower # (optional)
npm install -g [email protected]
check whether you have installed the latest version of SDK, not the LTS one.
Thanks, Steve Smith, Scott Addie, Rick Anderson, Noel Rice, and Shayne Boyer for the kind tutorial.
The tutorial link: https://learn.microsoft.com/en-us/aspnet/core/client-side/yeoman
I've had the same issue. Turned out that Yeoman generator did produce project.json
as build config file which was replaced by .csproj file with the release of 1.0.0-preview3-004056.
Obviously, your version of dotnet is preview3 or higher, that's why MSBUILD looks for .csproj
file and fails to find it.
In order to migrate from project.json
to .csproj
you can run:dotnet migrate
And then you can run:dotnet restore
dotnet build
dotnet run
Worked out for me just fine.
I just had the same problem, after following the links posted by Sender and reading around it is indeed because of the move from project.json back to the XML project file introduced in Preview3, so if you have Preview 3 or later installed you may see this error. dotnet restore will take the latest version by default.
To see which versions of dotnet core you have installed just look in \Program Files\dotnet\sdk
There is actually a very simple work-around (see bottom of page here) which allows you to run multiple versions of core side by side. So in the parent folder above the generated project include a file called global.json with the following contents:
{
"projects": [ "your-project-name" ],
"sdk": {
"version": "1.0.0-preview2-003131"
}
}
Notes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With