Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating ASP.NET Core SQL Cache table

I'm trying to generate the Distributed SQL Server Cache for ASP.NET Core 2.0, using the CLI, but I only get an error. The instructions say to execute

dotnet sql-cache create <connection string>  <schema>  <table name>

but when I do, it simply responds with No executable found matching command "dotnet-sql-cache".

I have installed Microsoft.Extensions.Caching.SqlConfig.Tools 2.0.0 on that project. So it should work from the project root, no?

When I execute dotnet -h, I get .NET Command Line Tools (2.0.2), etc. Surprisingly enough, sql-cache is not listed there among the SDK commands, alongside new, restore, run, migrate, etc. Shouldn't it be?

like image 264
David Avatar asked Nov 18 '17 05:11

David


2 Answers

I faced many troubles installing this tool, the only solution which worked for me was the one from @PAS, but only after adding the exact .Net Core version to the package installer.

Installing the latest one or even a slightly different one like 3.1.2 failed miserably.

So, the command line became :

dotnet tool install --global dotnet-sql-cache --version 3.1.0
like image 83
XavierAM Avatar answered Sep 19 '22 14:09

XavierAM


I have found installing certain Tools to be troublesome when I have used Nuget either by using the CLI or the package manager. In the past I have had to directly install a tool in the csproj file. Check your csproj file and see if the installation of the SqlConfig took hold. If it has not just add it and run a dotnet restore. Here is an example of how to "hard code" the tool. ```

<ItemGroup>
<DotNetCliToolReference 
     Include="Microsoft.Extensions.Caching.SqlConfig.Tools" 
     Version="2.0.0" />
</ItemGroup>

Also, here is a link to where a better explanation to the issue. It also recommends installing Microsoft.Extensions.Caching.SqlServer if you have not already done so but I would try this solution first. Hope this helps.

like image 26
sjgallen Avatar answered Sep 19 '22 14:09

sjgallen