{"id":25455,"date":"2018-06-17T20:07:00","date_gmt":"2018-06-17T20:07:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/?p=25455"},"modified":"2019-02-14T20:18:00","modified_gmt":"2019-02-15T03:18:00","slug":"net-core-2-1-update-strategy","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/premier-developer\/net-core-2-1-update-strategy\/","title":{"rendered":".NET Core 2.1 Update strategy"},"content":{"rendered":"<p>This post is provided by App Dev Manager <a href=\"https:\/\/www.linkedin.com\/in\/anant-dimri-b05b517\/\">Anant Dimri<\/a> who shares some helpful Q\/A around .NET Core patching strategy.<\/p>\n<hr>\n<p>We know that we can create two types of deployments for .NET Core applications:<\/p>\n<ul>\n<li><strong>Framework-dependent deployment<\/strong>. As the name implies, framework-dependent deployment (FDD) relies on the presence of a shared system-wide version of .NET Core on the target system. Because .NET Core is already present, your app is also portable between installations of .NET Core. Your app contains only its own code and any third-party dependencies that are outside of the .NET Core libraries. FDDs contain <em>.dll<\/em> files that can be launched by using the <a href=\"https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/tools\/dotnet\">dotnet utility<\/a> from the command line. For example, <code>dotnet app.dll<\/code> runs an application named <code>app<\/code>.<\/li>\n<li><strong>Self-contained deployment<\/strong>. Unlike FDD, a self-contained deployment (SCD) doesn&#8217;t rely on the presence of shared components on the target system. All components, including both the .NET Core libraries and the .NET Core runtime, are included with the application and are isolated from other .NET Core applications. SCDs include an executable (such as <em>app.exe<\/em> on Windows platforms for an application named <code>app<\/code>), which is a renamed version of the platform-specific .NET Core host, and a <em>.dll<\/em> file (such as <em>app.dll<\/em>), which is the actual application.<\/li>\n<\/ul>\n<p>In a package, you can have .NET core runtime dlls as well as your or 3<sup>rd<\/sup> party dlls that you have referenced. When planning for a patching strategy for your .NET core apps, there are certain nuances and questions that come up.<\/p>\n<p><strong>Question<\/strong>: When you publish ASP.NET Core web application that use CodeGen applications, it creates a <em>runtimes<\/em> folder. Can you help me understand what causes the runtimes directory to be created?<\/p>\n<p><strong>Answer<\/strong>: Runtimes folder is created whenever any native (os\/architecture specific) assets are resolved from nuget packages. When the native assets are part of a \u201cshared framework\u201d or \u201cRuntime store\u201d, they get knocked out of the published output because they are in the \u201cplatform\u201d. You shouldn\u2019t be able to delete the folder. At startup, the app is supposed to be checked for completeness. <br>For .NET Core 2.0 and ASP.NET Core 2.0 and higher, we no longer recommend referencing the individual packages. Just target netcoreapp2.0 and reference the Microsoft.AspNetCore.All (or .App in 2.1). Then you can bring in a smaller set of packages that are not in the platform.<\/p>\n<p><strong>Question<\/strong>: When you publish ASP.NET Core web application that uses CodeGen applications, it creates a <em>refs<\/em> folder.&nbsp;&nbsp; What is this used for?<\/p>\n<p><strong>Answer<\/strong>: The \u201crefs\u201d folder is created when the &lt;PreserveCompilationContext&gt; msbuild property is set to true. This is required for applications that need to preserve the assemblies that were used during compilation, typically because they need to do some compilation at runtime as well, e.g. to compile Razor views.&nbsp; <\/p>\n<p>We set that to \u201ctrue\u201d by default when the project uses the Microsoft.NET.Sdk.Web (which ASP.NET Core projects should always be doing). However, our Razor packages include a target that during \u201cdotnet publish\u201d pre-compiles the Razor views and then removes the ref folder from the output. This behavior is enabled when the Microsoft.AspNetCore.Mvc.Razor.ViewCompilation package is referenced. It can be further controlled by setting the &lt; MvcRazorCompileOnPublish&gt; property. The Microsoft.AspNetCore.All package pulls in this package so that behavior is enabled by default for all new projects.<\/p>\n<p>In short, if you have Razor views in your application, we recommend configuring the project to compile them during publish, by referencing the Microsoft.AspNetCore.Mvc.Razor.ViewCompilation package. This will improve startup time and remove the \u201crefs\u201d folder from our publish output for you.<\/p>\n<p><strong>Question<\/strong>: How does the minor version roll-forward work based, as outlined by this article <a href=\"https:\/\/na01.safelinks.protection.outlook.com\/?url=https%3A%2F%2Furldefense.proofpoint.com%2Fv2%2Furl%3Fu%3Dhttps-3A__na01.safelinks.protection.outlook.com_-3Furl-3Dhttps-253A-252F-252Fblogs.msdn.microsoft.com-252Fdotnet-252F2018-252F02-252F02-252Fnet-2Dcore-2D2-2D1-2Droadmap-252F-26data-3D04-257C01-257CJoseph.Healy-2540microsoft.com-257Cc3adf1731f164bded4f508d585060945-257C72f988bf86f141af91ab2d7cd011db47-257C1-257C0-257C636561183346967909-257CUnknown-257CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ-253D-253D-257C-2D2-26sdata-3DG8OaTYpBNJG3vR-252Fgid9u-252B02wtVljIzhrFbN2eKlHFbU-253D-26reserved-3D0%26d%3DDwMFAg%26c%3DAgWC6Nl7Slwpc9jE7UoQH1_Cvyci3SsTNfdLP4V1RCg%26r%3DEKqxDVrn3O6RNqjPhDBS2OHJWNf_xmrEcdEM9fuIOOw%26m%3DO1AG95RYtA9M3fbOXgbW92fvmbpbDdBmRxge5MpHxVU%26s%3DQyjmjFujW46bbHMOyEa2ITD20mU9LcqKPk4YIaE-8x4%26e%3D&amp;data=04%7C01%7CJoseph.Healy%40microsoft.com%7C6a8066f21e9c484464bb08d58508af5b%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636561194729560480%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwifQ%3D%3D%7C-2&amp;sdata=ySlKAxh2MuoYoS81%2BWPxyPbgkhTNVgAWO%2FeoUDW9h7g%3D&amp;reserved=0\">https:\/\/blogs.msdn.microsoft.com\/dotnet\/2018\/02\/02\/net-core-2-1-roadmap\/<\/a><\/p>\n<p><strong>Answer<\/strong>:&nbsp; With 2.0,&nbsp; version 2.0.3 rolls forward to 2.0.5 if its installed. 2.0.3 <em>does not<\/em> roll forward to 2.1.0 if its installed<\/p>\n<p>Starting with 2.1, version 2.0.3 will roll forward to 2.1 if and only if there is not 2.0.X on the machine that satisfies it. We do our best to maintain compatibility between minor versions but if an application doesn\u2019t work properly when rolling forward to a new minor, we recommend that a runtime with a minor matching the one the application was built for be installed. We prefer the thing that is closest to what the application was built with plus critical maintenance patches.<\/p>\n<p><b><\/b><\/p>\n<p>Special thanks and shoutout to Azure .NET core team and our awesome partner Matthew, <a href=\"https:\/\/na01.safelinks.protection.outlook.com\/?url=https%3A%2F%2Fgithub.com%2Fmchender&amp;data=02%7C01%7Canantd%40exchange.microsoft.com%7Cf5fe5684e18f47854ecf08d5bc2bcf6c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636621818716427512&amp;sdata=RQK2uGxnX7olrfD1ogdXvLXX2qC%2BeOKVcUtIbiGZFTs%3D&amp;reserved=0\">https:\/\/github.com\/mchender<\/a><\/p>\n<hr>\n<p><a href=\"https:\/\/blogs.msdn.com\/b\/premier_developer\/archive\/2014\/09\/15\/welcome.aspx\"><strong>Premier Support for Developers<\/strong><\/a> provides strategic technology guidance, critical support coverage, and a range of essential services to help teams optimize development lifecycles and improve software quality.&nbsp; Contact your Application Development Manager (ADM) or <a href=\"https:\/\/blogs.msdn.microsoft.com\/premier_developer\/contact-us\/\">email us<\/a> to learn more about what we can do for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This post is provided by App Dev Manager Anant Dimri who shares some helpful Q\/A around .NET Core patching strategy. We know that we can create two types of deployments for .NET Core applications: Framework-dependent deployment. As the name implies, framework-dependent deployment (FDD) relies on the presence of a shared system-wide version of .NET Core [&hellip;]<\/p>\n","protected":false},"author":582,"featured_media":37840,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[106,3],"class_list":["post-25455","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-permierdev","tag-net","tag-team"],"acf":[],"blog_post_summary":"<p>This post is provided by App Dev Manager Anant Dimri who shares some helpful Q\/A around .NET Core patching strategy. We know that we can create two types of deployments for .NET Core applications: Framework-dependent deployment. As the name implies, framework-dependent deployment (FDD) relies on the presence of a shared system-wide version of .NET Core [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/25455","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/users\/582"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/comments?post=25455"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/posts\/25455\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media\/37840"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/media?parent=25455"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/categories?post=25455"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/premier-developer\/wp-json\/wp\/v2\/tags?post=25455"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}