Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET core RC1 to 1.0.0 migration errors

I am trying to migrate my asp.net core 1.0.0 RC1 application to final 1.0.0 and with the help of other posts I managed to change all references from RC1 to final 1.0.0 But still there are couple of errors remains which I cant find suitable replacement methods or references

app.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear());

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

I have "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0" in project.json

services.AddEntityFramework().AddSqlServer()
.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(Configuration["Data:DefaultConnection:ConnectionString"]));

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

I have "Microsoft.EntityFrameworkCore": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0", in project.json

Please could anyone help me to resolve these? Thanks in advance.

like image 414
Sameer Pawar Avatar asked Jul 30 '16 11:07

Sameer Pawar


1 Answers

For first issue,

remove app.UseIISPlatformHandler line and add UseIISIntegration() in Main method like below-

public static void Main(string[] args)
        {
            var host = new WebHostBuilder()
                .UseKestrel()
                .UseContentRoot(Directory.GetCurrentDirectory())
                .UseIISIntegration()    // Replaces call to UseIISPlatformHandler
                .UseStartup<Startup>()
                .Build();


            host.Run();
        }

For second issue,

Use services.AddEntityFrameworkSqlServer() instead of services.AddEntityFramework().AddSqlServer()

References:

Migrating from ASP.NET 5 RC1 to ASP.NET Core 1.0 https://docs.asp.net/en/latest/migration/rc1-to-rtm.html

Migrating from ASP.NET Core RC2 to ASP.NET Core 1.0 https://docs.asp.net/en/latest/migration/rc2-to-rtm.html

See if this helps.

like image 183
Sanket Avatar answered Oct 03 '22 18:10

Sanket