aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Publish doesnt work anymore (From 1.1 to 2.0)

Open ranouf opened this issue 9 years ago • 5 comments

Hi,

I just updated my project from Asp.Net Core 1.1 to 2.0.

I followed this instruction: https://docs.microsoft.com/en-us/aspnet/core/migration/1x-to-2x/

I updated my Main void, because of "IDesignTimeDbContextFactory" error I had with Add-Migration.

I have 2 problems:

1/ In Appsettings.json, i have:

  "ConnectionStrings": {
    "Default": "Server=localhost; Database=DB; Trusted_Connection=True;MultipleActiveResultSets=True;"
  },

In Startup.cs, I had: in ConfigureServices

            services.AddDbContext<AppDbContext>(options =>
                 options.UseSqlServer(Configuration.GetConnectionString("Default")));

But It doesnt work, I had to do this instead:

            services.AddDbContext<AppDbContext>(options =>
                 options.UseSqlServer("Server=localhost; Database=DB; Trusted_Connection=True;MultipleActiveResultSets=True;"));

If not, I have an Error about Sql Script Generation Failed

2/Publish of my Web App, when I click on publish, the button become disable, then become enable again. No error message, nothing nowhere. I really dont know what happen or how I can debug it.

Thanks for your help

ranouf avatar Aug 24 '17 14:08 ranouf

About the 2/, I discovered the preview Publish option, the error i Have when I use it is: "The SDK 'Microsoft.NET.Sdk.Web' specified could not be found".

I will do some investigation and will let you know

ranouf avatar Aug 24 '17 16:08 ranouf

About the 2/, I found the solution here: https://andrewlock.net/the-sdk-microsoft-net-sdk-web-specified-could-not-be-found/ In global.json, update the sdk version:

  "sdk": {
    "version": "2.0.0"
  }

ranouf avatar Aug 24 '17 18:08 ranouf

Hi,

I still have an issue with Configuration.GetConnectionString.

Is there someone who know to fix that?

ranouf avatar Aug 25 '17 21:08 ranouf

@ranouf Check the ConnectionStrings in appsetting.Development.json when your environment is development. image

zzyykk123456 avatar Sep 20 '17 04:09 zzyykk123456

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.

aspnet-hello avatar Dec 30 '17 23:12 aspnet-hello