Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 363 Vote(s) - 3.48 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'IServiceCollection' does not contain a definition for 'AddSpaStaticFiles'

#1
I cant figure out why Startup.cs is throwing this error. I tried the solutions suggested [here][1] (including restarting my machine and running dotnet restore) with no luck. Any ideas?

>CS1061 'IServiceCollection' does not contain a definition for 'AddSpaStaticFiles' and no accessible extension method 'AddSpaStaticFiles' accepting a first argument of type 'IServiceCollection' could be found (are you missing a using directive or an assembly reference?)


[![enter image description here][2]][2]

using statements at the top of startup.cs:

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Myproject.Models;

using Microsoft.EntityFrameworkCore;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using System.Text;
//Install-Package Microsoft.AspNetCore.Session
//Install-Package AutoMapper.Extensions.Microsoft.DependencyInjection

My .csproj file contains:

<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="5.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Session" Version="2.1.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="5.2.4" />
<PackageReference Include="Flurl.Http" Version="2.2.1" />
<PackageReference Include="jQuery" Version="3.3.1" />
<PackageReference Include="jQuery.Validation" Version="1.17.0" />
<PackageReference Include="LeanKit.API.Client" Version="1.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.2" />

<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
</ItemGroup>

<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.1.0-preview1-final" />
</ItemGroup>


[1]:

[To see links please register here]

[2]:
Reply

#2
You need to install these two NuPackages:

[![enter image description here][1]][1]


We can see this is an extension method in the assembly of `Microsoft.AspNetCore.SpaServices.Extensions`

[![enter image description here][2]][2]


[1]:

[2]:
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through