Define that in your project.json:
"tools": {
"dotnet-ef": "1.0.0-*"
},
dependency: "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview1-final",
then SAVE!
Now the nuget restore starts in Visual studio but I get this error among the other error below:
error: Unable to resolve 'dotnet-ef (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
info : Committing restore...
log : Writing lock file to disk. Path: C:\TGB.Core\TGB.Api\project.lock.json
log : C:\TGB.Core\TGB.Api\TGB.Api.xproj
log : Restore failed in 1915ms.
Errors in C:\TGB.Core\TGB.Api\TGB.Api.xproj
Unable to resolve 'dotnet-ef (>= 1.0.0)' for '.NETCoreApp,Version=v1.0'.
Why is this nuget: Microsoft.EntityFrameworkCore.Tools not compatible - somehow - with my
framework: net461 project?
I get this error:
Severity Code Description Project File Line Suppression State
Error Could not find a part of the path 'C:\Users\bastien.nuget\packages.tools\dotnet-ef'. TGB.Api C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DotNet\Microsoft.DotNet.Common.Targets 241
Line 241 is:
<Dnx
RuntimeExe="$(SDKToolingExe)"
Condition="'$(_DesignTimeHostBuild)' != 'true'"
ProjectFolder="$(MSBuildProjectDirectory)"
Arguments="$(_BuildArguments)"
/>
When I do run "dotnet ef --help" in the TGB.Api project directory on the CMD I get this error:
C:\TGB.Core\TGB.Api>dotnet ef --help
Unhandled Exception: System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\bastien\.nuget\packages\.tools\dotnet-ef'.
at System.IO.Win32FileSystemEnumerableIterator`1.CommonInit()
at System.IO.Win32FileSystemEnumerableIterator`1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler`1 resultHandler)
at System.IO.Win32FileSystemEnumerableFactory.CreateFileNameIterator(String path, String originalUserPath, String searchPattern, Boolean includeFiles, Boolean includeDirs, SearchOption searchOption)
at System.IO.Win32FileSystem.EnumeratePaths(String fullPath, String searchPattern, SearchOption searchOption, SearchTarget searchTarget)
at System.IO.Directory.EnumerateFileSystemNames(String path, String searchPattern, SearchOption searchOption, Boolean includeFiles, Boolean includeDirs)
at System.IO.Directory.EnumerateDirectories(String path)
at Microsoft.DotNet.Cli.Utils.ToolPathCalculator.GetAvailableToolVersions(String packageId)
at Microsoft.DotNet.Cli.Utils.ToolPathCalculator.GetBestLockFilePath(String packageId, VersionRange versionRange, NuGetFramework framework)
at Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.GetToolLockFilePath(LibraryRange toolLibrary, String nugetPackagesRoot)
at Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.GetToolLockFile(LibraryRange toolLibrary, String nugetPackagesRoot)
at Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.ResolveCommandSpecFromToolLibrary(LibraryRange toolLibraryRange, String commandName, IEnumerable`1 args, ProjectContext projectContext)
at Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.ResolveCommandSpecFromAllToolLibraries(IEnumerable`1 toolsLibraries, String commandName, IEnumerable`1 args, ProjectContext projectContext)
at Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.ResolveFromProjectTools(String commandName, IEnumerable`1 args, String projectDirectory)
at Microsoft.DotNet.Cli.Utils.ProjectToolsCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.Cli.Utils.CompositeCommandResolver.Resolve(CommandResolverArguments commandResolverArguments)
at Microsoft.DotNet.Cli.Utils.CommandResolver.TryResolveCommandSpec(String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath)
at Microsoft.DotNet.Cli.Utils.Command.Create(String commandName, IEnumerable`1 args, NuGetFramework framework, String configuration, String outputPath)
at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, ITelemetry telemetryClient)
at Microsoft.DotNet.Cli.Program.Main(String[] args)
When I do "dotnet ef --helpf" on the CMD I expect to get the help...
dotnet --info output:
.NET Command Line Tools (1.0.0-preview1-002702)
Product Information:
Version: 1.0.0-preview1-002702
Commit Sha: 6cde21225e
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
RID: win10-x64
Sorry for the confusion in the repro steps, but the "bug" is behaving very ambivalent...
Should have better read the official docu: https://github.com/aspnet/EntityFramework.Docs/blob/master/docs/cli/dotnet.rst
instead of following some half-done www tuts...
I had this problem when I did a dotnet publish. Before that I did a dotnet restore and the write to _project.lock.json_ failed (because TFS set it to read-only)
The publish was looking for _Microsoft.AspNetCore.Server.IISIntegration.Tools_ in .../packages/.tools
When a removed the read-only property and did the restore again, the publish worked fine.
Most helpful comment
I had this problem when I did a dotnet publish. Before that I did a dotnet restore and the write to _project.lock.json_ failed (because TFS set it to read-only)
The publish was looking for _Microsoft.AspNetCore.Server.IISIntegration.Tools_ in .../packages/.tools
When a removed the read-only property and did the restore again, the publish worked fine.