We have recently added a few interesting features for ASP.NET publishing. The updates include:
Container Registry Publish Updates
Container development (e.g. Docker) has grown in popularity recently, including in .NET development. We’ve started adding support for containerized applications in Visual Studio as well. When developing a containerized app, there are two components that are needed to run your application.
- App image
- Host to run the container
The app image includes the application itself and info about configuring the machine hosting the application.
The host machine will load the app image and run it. There are a variety of options for the host machine that can be used. In previous releases we supported publishing a containerized ASP.NET Core project to Azure Container Registry (ACR) and creating a new Azure App Service to host the application. If you were running your application using a different host, Visual Studio wouldn’t have helped. Now in Visual Studio we have the following container publish related features:
- A: Publish an ASP.NET Core containerized app to ACR and a new Azure App Service (Visual Studio 2017 15.0)
- B: Publish an ASP.NET (Core or full .NET Framework) containerized project to a container registry (including, but not limited to, ACR) (Visual Studio 2017 15.5 Preview 2)
Feature A enabled Azure App Service users to run a containerized ASP.NET Core app to a new Azure App Service host. This feature was included in the initial release Visual Studio 2017. We are including it here for completeness. To publish one of these apps to App Service you’ll use the Microsoft Azure App Service Linux option in the publish page. See the next image.
After selecting this option you’ll be prompted to configure the new App Service instance and the container registry settings.
For feature B, we have added a new Container Registry publish option on the Publish page. You can see an image of that below.
The radio buttons below the Container Registry button lists out the different options. Let’s take a closer look at those in the table below.
|Option||When to use|
|Create New Azure Container Registry||Select this option when you want to publish your app image to a new Azure Container Registry. You can publish several different app images to the same Container Registry.|
|Select Exiting Azure Container Registry||Select this option when you’ve already created the Azure Container Registry, and you want to publish a new app image to it.|
|Docker hub||Select this option if you want to publish to docker hub (hub.docker.com).|
|Custom||Select this option to explicitly set publish options.|
After selecting the appropriate option and clicking the Publish button, you’ll be prompted to complete the configuration and continue to publish. The Container Registry publish feature is enabled for both ASP.NET Core and ASP.NET full .NET Framework projects.
To try out the Azure related features you’ll need an Azure subscription. If you don’t already have one you can get started for free.
We’ve only briefly covered the Container Registry features here. We will be blogging more soon about how to use this in end-to-end scenarios here. Until then you can take a look at the docs. Now let’s move on to the next update.
Create Publish Profile Without Publishing
In Visual Studio publishing to a new destination includes two steps:
- Create Publish Profile
- Start publishing
In Visual Studio 2017 15.5 Preview 2 we have added a new gear option next to the Publish button. In previous releases of Visual Studio 2017 when you created a publish profile, the publish process was automatically started immediately after that. This prevented you from changing publish settings for the initial publish. We’ve heard feedback from users that in some cases the publish options need to be customized before the initial publish. Some reasons you may chose to delay the publish process includes; you need to configure databases, you need to change the Build Configuration used, you want to validate publish credentials before publish, etc. In the image below you can see the new gear option highlighted.
To create a publish profile and not publish, after selecting the publish destination (by clicking on one of the big buttons) and then clicking on the gear you’ll get a context menu with two options. You’ll want to select Create Profile.
After you select Create Profile here, you’ll continue to create the profile, and any new Azure resources if applicable. You can then publish your app at a later time with the Publish button. The following image shows this button.
These were some updates that we wanted to share with you. We’ll be blogging more soon about how to use the container features in full scenarios. If you have any questions, please comment below or email me at sayedha AT microsoft.com or on Twitter @SayedIHashimi. You can also use the built in send feedback feature in Visual Studio 2017.
Sayed Ibrahim Hashimi