{"action":"created","issue":{"url":"https://api.github.com/repos/aspnet/Home/issues/1381","repository_url":"https://api.github.com/repos/aspnet/Home","labels_url":"https://api.github.com/repos/aspnet/Home/issues/1381/labels{/name}","comments_url":"https://api.github.com/repos/aspnet/Home/issues/1381/comments","events_url":"https://api.github.com/repos/aspnet/Home/issues/1381/events","html_url":"https://github.com/aspnet/Home/issues/1381","id":146568234,"number":1381,"title":"Notes about my own experience migrating from RC1 to RC2","user":{"login":"Bartmax","id":3386797,"avatar_url":"https://avatars.githubusercontent.com/u/3386797?v=3","gravatar_id":"","url":"https://api.github.com/users/Bartmax","html_url":"https://github.com/Bartmax","followers_url":"https://api.github.com/users/Bartmax/followers","following_url":"https://api.github.com/users/Bartmax/following{/other_user}","gists_url":"https://api.github.com/users/Bartmax/gists{/gist_id}","starred_url":"https://api.github.com/users/Bartmax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bartmax/subscriptions","organizations_url":"https://api.github.com/users/Bartmax/orgs","repos_url":"https://api.github.com/users/Bartmax/repos","events_url":"https://api.github.com/users/Bartmax/events{/privacy}","received_events_url":"https://api.github.com/users/Bartmax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":32,"created_at":"2016-04-07T10:00:07Z","updated_at":"2016-04-29T12:57:11Z","closed_at":null,"body":"@davidfowl asked me for notes so here they are. You may want to scroll down to the pain points section below :)\r\n\r\n# Migration RC1 to RC2#\r\n\r\n## Easy/expected changes:##\r\n \r\n\r\n### Tools\r\ninstall RC2 tooling.\r\nThe lastest tools can be found here: https://github.com/dotnet/cli\r\nWe first started with https://dotnet.github.io/getting-started/ but it's outdated.\r\n\r\n### global.json\r\nUpdate version of global.json to match RC2\r\n```json\r\n\"version\": \"1.0.0-rc1-update1\" // BEFORE\r\n\"version\": \"1.0.0-rc2-20221\" // AFTER\r\n```\r\n### Nuget.config\r\nadd ci builds to nuget config\r\n```xml \r\n<add key=\"AspNetCiDev\" value=\"https://www.myget.org/F/aspnetcidev/api/v3/index.json\" />\r\n```\r\n### project.json\r\n\r\n#### Dependencies\r\nUpdate all dependencies from `Microsoft.AspNet.xxx` to `Microsoft.AspNetCore.xxx` except `Microsoft.AspNet.WebApi.Client`\r\n\r\nUpdate all dependencies from `x.EntityFramework.x` to `x.EntityFrameworkCore.x`\r\nDowngrade version to 1.0 on all dependencies renamed.\r\n\r\nSome package rename were by hand because it wasn't a straight convention,\r\n`Microsoft.AspNetCore.Diagnostics.Entity`\r\n`Microsoft.EntityFrameworkCore.SqlServer`\r\n\r\nSome low-impact packages were removed:\r\n`Microsoft.VisualStudio.Web.BrowserLink.Loader`\r\n\r\nExternal dependency `Moq` changed package name\r\n```json\r\n\"Moq\": \"\", // BEFORE\r\n\"moq.netcore\": \"4.4.0-beta8\", // AFTER\r\n```\r\n\r\n\r\n#### Frameworks\r\nUpdate TFM. This change was a complete copy paste of some sample code. We had no idea what this change means.\r\nbefore:\r\n```json\r\n  \"frameworks\": {\r\n    \"dnx451\": { },\r\n    \"dnxcore50\": { }\r\n  },\r\n```\r\nafter:\r\n```json\r\n  \"frameworks\": {\r\n    \"netcoreapp1.0\": {\r\n      \"imports\": [ \"dnxcore50\", \"portable-net45+win8\" ]\r\n    }\r\n  },\r\n```\r\n\r\n### Code Changes\r\n**NOTE:** `BEFORE` code may contain AspNetCore \r\nbecause of the initial rename of all `using` directive.\r\n\r\n#### Usings\r\nRename all using directives in *.cs, *.cshtml\r\nFind all and replace: `using Microsoft.AspNet.` -> `using Microsoft.AspNetCore.`\r\nAbout 122 occurrence(s).\r\n\r\n#### Controllers\r\n\r\n```csharp\r\nHttpNotFound // BEFORE 60 ocurrences\r\nNotFound // AFTER \r\n\r\nHttpBadRequest() // BEFORE 5 ocurrences\r\nBadRequest() // AFTER \r\n```\r\n\r\n#### Entity Framework\r\nGraphBehavior.X does not exist anymore on EF context methods.\r\n\r\n```csharp\r\nusing Microsoft.AspNetCore.Identity.EntityFramework; // BEFORE 2 ocurrences\r\nusing Microsoft.AspNetCore.Identity.EntityFrameworkCore; // AFTER\r\n\r\nusing Microsoft.Data.Entity; // BEFORE 40 ocurrences\r\nusing Microsoft.EntityFrameworkCore; // AFTER\r\n\r\nusing Microsoft.Data.Entity.Metadata; // BEFORE 35 ocurrences\r\nusing Microsoft.EntityFrameworkCore.Metadata; // AFTER\r\n\r\nusing Microsoft.Data.Entity.Migrations; // BEFORE 47 ocurrences\r\nusing Microsoft.EntityFrameworkCore.Migrations; // AFTER\r\n\r\nusing Microsoft.Data.Entity.Infrastructure; // BEFORE 24 ocurrences\r\nusing Microsoft.EntityFrameworkCore.Infrastructure; // AFTER\r\n\r\n_context.Phones.Add(phone, GraphBehavior.IncludeDependents); // SAMPLE\r\n_context.Phones.Add(phone); // SAMPLE AFTER\r\n\r\n```\r\n\r\n#### Extensions\r\n```csharp\r\nusing Microsoft.AspNetCore.FileProviders; // AFTER 3 ocurrences\r\nusing Microsoft.Extensions.FileProviders; // BEFORE\r\n\r\nusing Microsoft.Extensions.OptionsModel; // BEORE 1 ocurrences\r\nusing Microsoft.Extensions.Options; // AFTER\r\n```\r\n\r\n\r\n#### Identity\r\n`User.GetUserId()` and `User.IsSignedIn()` doesn't exist. it was removed and added to `UserManager` and `SignInManager`.\r\n\r\n`ExternalLoginInfo.ExternalPrincipal` was renamed to `ExternalLoginInfo.Principal`\r\n```csharp\r\nUser.GetUserId() // BEFORE 6 ocurrences\r\n_userManager.GetUserId(User) // AFTER\r\n\r\nUser.IsSignedIn() // BEFORE 2 ocurrences\r\n_signInManager.IsSignedIn(User) // AFTER\r\n\r\ninfo.ExternalPrincipal // BEFORE\r\ninfo.Principal // AFTER\r\n```\r\n\r\n\r\n#### Startup\r\n```csharp\r\nservices.AddEntityFramework()\r\n                .AddSqlServer() // BEFORE\r\n\r\nservices.AddEntityFrameworkSqlServer()\r\n                .AddEntityFrameworkSqlServer() // AFTER\r\n                \r\nservices.AddCaching(); // NOT FOUND ??? REMOVED \r\napp.UseDatabaseErrorPage(); // NOT FOUND ??? REMOVED\r\n\r\napp.UseRequestLocalization(\r\n    new RequestCulture(\r\n        new CultureInfo(\"en-us\"))); // BEFORE\r\napp.UseRequestLocalization(\r\n    new RequestLocalizationOptions() { \r\n        DefaultRequestCulture = new RequestCulture(\r\n            new CultureInfo(\"en-us\")) }); // AFTER\r\n\r\napp.UseIISPlatformHandler(options => options.AuthenticationDescriptions.Clear()); // NEED MORE INVESTIGATION. OPTIONS REMOVED.\r\n\r\n``` \r\n\r\nThis change is a complete copy/paste from sample. No idea what's going on here.\r\n```csharp\r\n// Entry point for the application. BEFORE\r\n        public static void Main(string[] args) => WebApplication.Run<Startup>(args);\r\n        \r\n// Entry point for the application. AFTER\r\n        public static void Main(string[] args)\r\n        {\r\n            var host = new WebHostBuilder()\r\n                        .UseKestrel()\r\n                        .UseContentRoot(Directory.GetCurrentDirectory())\r\n                        .UseDefaultHostingConfiguration(args)\r\n                        .UseIIS()\r\n                        .UseStartup<Startup>()\r\n                        .Build();\r\n\r\n            host.Run();\r\n        }\r\n\r\n```\r\n\r\n\r\n\r\n\r\n\r\n<hr>\r\n\r\n## Pain points:\r\n\r\n### DotNet Restore\r\nThis was executed multiple times, at different point of migration.\r\nMostly all the output was kinda useless. Too much information, to many unknowns.\r\nWe tried to switch to -v warning with no luck. \r\nIt took some time to get to -v Minimal to get a usefull output from dotnet restore.\r\n\r\n### App Settings\r\nWe found a runtime Error with regarding appsettings. The error was clear, the options available not.\r\nThe fix was to change Verbose to Information\r\n```json\r\n\"Logging\": {\r\n    \"IncludeScopes\": false,\r\n    \"LogLevel\": {\r\n      \"Default\": \"Information\", // BEFORE: \"Verbose\"\r\n      \"System\": \"Information\",\r\n      \"Microsoft\": \"Information\"\r\n    }\r\n  }\r\n```\r\n\r\nWe used POCO Configuration with code like: \r\n```csharp\r\nservices.Configure<StorageSettings>(Configuration.GetSection(\"StorageSettings\"));\r\n```\r\nwe dig into lots of documents, code, issues. \r\nWe hope this would be on Announcements repo but we couldn't find it.\r\nwe ended up with a hack\r\n```csharp\r\nservices.Configure<StorageSettings>(x => x.ConnectionString = Configuration[\"StorageSettings:ConnectionString\"]);\r\n```\r\n\r\n### Code\r\nSome inner workings of razor,views,engines,etc changes weren't mentioned anywhere.\r\nWe have a simple taghelper that render partial views, this was impossible to figure out how to update it.\r\nNTaylorMullen helped there.\r\n\r\n\r\n## Compile success!\r\nGreat, right... right?\r\n\r\n### Environment\r\nVisual Studio environment variable wasn't respected. We first thought that `ConfigureDevelopment` were removed.\r\nThe problem here was that dotnet run shows the enviroment but an error was throw before.\r\nAlso this environment variable was changed twice for RC2. The announcement issue shows the old one with a note at the bottom that was changed again.\r\nWe wasted lot of time dealing with environment. mostly because of not understading the problem straight.\r\n\r\n### cshtml\r\n@inject namespaces had to be renamed,\r\ntaghelpers, etc.\r\nbecause this was after hitting a specific page it was more painful than the cs code.\r\nwe also lost intellisense so... we had to rely on error messages.\r\n\r\n\r\n### tooling\r\nWe literally copy pasted every tooling sample until we got this:\r\n```json\r\n  \"tools\": {\r\n    \"dotnet-publish-iis\": \"1.0.0-*\",\r\n    \"dotnet-ef\": \"1.0.0-*\",\r\n    \"dotnet-watch\": \"1.0.0-*\",\r\n    \"dotnet-razor-tooling\": \"1.0.0-*\"\r\n  },\r\n```\r\nWe still have no idea how those exactly works. \r\nThe only one that was really needed was EF because migrations (see next point).\r\nWe tried for several hours to get `dotnet-watch` to run without success.\r\n\r\n### EF Changes\r\nI hit this issue: [Invalid object name 'TableName'](https://github.com/aspnet/EntityFramework/issues/4979)\r\nbefore an announcement were created here:\r\n[EF Core: Table names now taken from DbSet names (starting in RC2)](https://github.com/aspnet/Announcements/issues/167).\r\n\r\nWhile it was a simple ask repo and got a solution very quickly, it was like a neverending error trip.\r\nAt this point we were tired.\r\n\r\n## ... And runs! ..., almost ##\r\nwe hit the web application but we seen no static files served!\r\nDAMN!\r\nWe looked everywhere until we figure out that no gulp build was executed! even we had that on `prepublish`.\r\nand well.. then\r\n\r\n## it worked.\r\n"},"comment":{"url":"https://api.github.com/repos/aspnet/Home/issues/comments/215703674","html_url":"https://github.com/aspnet/Home/issues/1381#issuecomment-215703674","issue_url":"https://api.github.com/repos/aspnet/Home/issues/1381","id":215703674,"user":{"login":"smbecker","id":125765,"avatar_url":"https://avatars.githubusercontent.com/u/125765?v=3","gravatar_id":"","url":"https://api.github.com/users/smbecker","html_url":"https://github.com/smbecker","followers_url":"https://api.github.com/users/smbecker/followers","following_url":"https://api.github.com/users/smbecker/following{/other_user}","gists_url":"https://api.github.com/users/smbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/smbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smbecker/subscriptions","organizations_url":"https://api.github.com/users/smbecker/orgs","repos_url":"https://api.github.com/users/smbecker/repos","events_url":"https://api.github.com/users/smbecker/events{/privacy}","received_events_url":"https://api.github.com/users/smbecker/received_events","type":"User","site_admin":false},"created_at":"2016-04-29T12:57:11Z","updated_at":"2016-04-29T12:57:11Z","body":"I think environment has always been based on an environment variable. So you would have to set `ASPNETCORE_ENVIRONMENT` before running. "}}