Skip to content

Commit

Permalink
Change library package manager to nuget package manager (#8946)
Browse files Browse the repository at this point in the history
The Library Package Manager menu item became NuGet Package Manager starting in VS 2015.

Contributes to #8848.
  • Loading branch information
gewarren authored and Rick-Anderson committed Oct 10, 2018
1 parent ba4b509 commit 701fc69
Show file tree
Hide file tree
Showing 54 changed files with 124 additions and 133 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ There are two ways to run the Fix It app:
4. In File Explorer, right-click the .zip file and click Properties, then in the Properties window click Unblock.
5. Unzip the file.
6. Double-click the .sln file to launch Visual Studio.
7. From the Tools menu, click Library Package Manager, then Package Manager Console.
7. From the **Tools** menu, click **NuGet Package Manager**, then **Package Manager Console**.
8. In the Package Manager Console (PMC), click Restore.
9. Exit Visual Studio.
10. Start the [Azure storage emulator](/azure/storage/common/storage-use-emulator).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ In this task, you will go through the steps of enabling **Entity Framework Code

1. Open Visual Studio and open the **GeekQuiz.sln** solution file from **Source\Ex1-UsingEntityFrameworkMigrations\Begin**.
2. Build the solution in order to download and install the **NuGet** package dependencies. To do this, right-click the solution and click **Build Solution** or press **Ctrl + Shift + B**.
3. From the **Tools** menu in Visual Studio, select **Library Package Manager**, and then click **Package Manager Console**.
3. From the **Tools** menu in Visual Studio, select **NuGet Package Manager**, and then click **Package Manager Console**.
4. In the **Package Manager Console**, enter the following command and then press **Enter**. An initial migration based on the existing model will be created.

[!code-powershell[Main](maintainable-azure-websites-managing-change-and-scale/samples/sample1.ps1)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ Katana currently provides two servers, both of which support Windows Integrated
> [!NOTE]
> Katana does not currently provide OWIN middleware for Windows Authentication, because this functionality is already available in the servers.

## Windows Authentication in IIS

Using Microsoft.Owin.Host.SystemWeb, you can simply enable Windows Authentication in IIS.
Expand All @@ -39,7 +38,7 @@ Let's start by creating a new ASP.NET application, using the "ASP.NET Empty Web

![](enabling-windows-authentication-in-katana/_static/image1.png)

Next, add NuGet packages. From the **Tools** menu, select **Library Package Manager**, then select **Package Manager Console**. In the Package Manager Console window, enter the following command:
Next, add NuGet packages. From the **Tools** menu, select **NuGet Package Manager**, then select **Package Manager Console**. In the Package Manager Console window, enter the following command:

[!code-console[Main](enabling-windows-authentication-in-katana/samples/sample1.cmd)]

Expand Down Expand Up @@ -69,7 +68,7 @@ Later, when you deploy the application to a server, follow [these steps](https:/

If you are using Microsoft.Owin.Host.HttpListener to self-host Katana, you can enable Windows Authentication directly on the **HttpListener** instance.

First, create a new console application. Next, add NuGet packages. From the **Tools** menu, select **Library Package Manager**, then select **Package Manager Console**. In the Package Manager Console window, enter the following command:
First, create a new console application. Next, add NuGet packages. From the **Tools** menu, select **NuGet Package Manager**, then select **Package Manager Console**. In the Package Manager Console window, enter the following command:

[!code-console[Main](enabling-windows-authentication-in-katana/samples/sample4.cmd)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ In the **New ASP.NET Project** dialog, select the **Empty** template.

### Add NuGet Packages

Next, add the required NuGet packages. From the **Tools** menu, select **Library Package Manager**, then select **Package Manager Console**. In the Package Manager Console window, type the following command:
Next, add the required NuGet packages. From the **Tools** menu, select **NuGet Package Manager**, then select **Package Manager Console**. In the Package Manager Console window, type the following command:

`install-package Microsoft.Owin.Host.SystemWeb –Pre`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ In general, an Azure application can contain multiple roles, although this tutor

## Add the OWIN Self-Host Packages

From the **Tools** menu, click **Library Package Manager**, then click **Package Manager Console**.
From the **Tools** menu, click **NuGet Package Manager**, then click **Package Manager Console**.

In the Package Manager Console window, enter the following command:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ by [Praburaj Thiagarajan](https://github.com/Praburaj), [Rick Anderson]((https:/

## Create an ASP.NET Web App using OWIN Startup

1. Create an empty Asp.Net web application and name it **StartupDemo**. - Install `Microsoft.Owin.Host.SystemWeb` using the NuGet package manager. From the **Tools** menu, select **Library Package Manager**, and then **Package Manager Console**. Enter the following command:
1. Create an empty Asp.Net web application and name it **StartupDemo**. - Install `Microsoft.Owin.Host.SystemWeb` using the NuGet package manager. From the **Tools** menu, select **NuGet Package Manager**, and then **Package Manager Console**. Enter the following command:

[!code-powershell[Main](owin-startup-class-detection/samples/sample7.ps1)]
2. Add an OWIN startup class. In Visual Studio 2013 right click the project and select **Add Class**.- In the **Add New Item** dialog box, enter *OWIN* in the search field, and change the name to Startup.cs, and then click **Add**.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,46 +28,46 @@ At the end of this tutorial, you will have an MVC application with the ASP.NET I
## Creating a MySQL database instance on Azure

1. Log in to the [Azure Portal](https://go.microsoft.com/fwlink/?linkid=529715&clcid=0x409).
2. Click **NEW** at the bottom of the page, and then select **STORE**:
2. Click **NEW** at the bottom of the page, and then select **STORE**:

[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image2.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image1.png)
3. In the **Choose and Add-on** wizard, select **ClearDB MySQL Database**, and then click the **Next** arrow at the bottom of the frame:
[Click the following image to expand it. ]
3. In the **Choose and Add-on** wizard, select **ClearDB MySQL Database**, and then click the **Next** arrow at the bottom of the frame:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image4.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image3.png)
4. Keep the default **Free** plan, change the **NAME** to **IdentityMySQLDatabase**, select the region that is nearest to you, and then click the **Next** arrow at the bottom of the frame:
[Click the following image to expand it. ]
4. Keep the default **Free** plan, change the **NAME** to **IdentityMySQLDatabase**, select the region that is nearest to you, and then click the **Next** arrow at the bottom of the frame:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image6.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image5.png)
5. Click the **PURCHASE** checkmark to complete the database creation.
[Click the following image to expand it. ]
5. Click the **PURCHASE** checkmark to complete the database creation.

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image8.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image7.png)
6. After your database has been created, you can manage it from the **ADD-ONS** tab in the management portal. To retrieve the connection information for your database, click **CONNECTION INFO** at the bottom of the page:
[Click the following image to expand it. ]
6. After your database has been created, you can manage it from the **ADD-ONS** tab in the management portal. To retrieve the connection information for your database, click **CONNECTION INFO** at the bottom of the page:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image10.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image9.png)
7. Copy the connection string by clicking on the copy button by the **CONNECTIONSTRING** field and save it; you will use this information later in this tutorial for your MVC application:
[Click the following image to expand it. ]
7. Copy the connection string by clicking on the copy button by the **CONNECTIONSTRING** field and save it; you will use this information later in this tutorial for your MVC application:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image12.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image11.png)

## Creating an MVC application project

To complete the steps in this section of the tutorial, you will first need to install [Visual Studio Express 2013 for Web](https://go.microsoft.com/fwlink/?LinkId=299058) or [Visual Studio 2013](https://go.microsoft.com/fwlink/?LinkId=306566). Once Visual Studio has been installed, use the following steps to create a new MVC application project:

1. Open Visual Studio 2103.
2. Click **New Project** from the **Start** page, or you can click the **File** menu and then **New Project**:
[Click the following image to expand it. ]
2. Click **New Project** from the **Start** page, or you can click the **File** menu and then **New Project**:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image2.jpg)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image1.jpg)
3. When the **New Project** dialog box is displayed, expand **Visual C#** in the list of templates, then click **Web**, and select **ASP.NET Web Application**. Name your project **IdentityMySQLDemo** and then click **OK**:
[Click the following image to expand it. ]
3. When the **New Project** dialog box is displayed, expand **Visual C#** in the list of templates, then click **Web**, and select **ASP.NET Web Application**. Name your project **IdentityMySQLDemo** and then click **OK**:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image14.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image13.png)
4. In the **New ASP.NET Project** dialog, select the **MVC** templatewith the default options; this will configure **Individual User Accounts** as the authentication method. Click **OK**:
[Click the following image to expand it. ]
4. In the **New ASP.NET Project** dialog, select the **MVC** templatewith the default options; this will configure **Individual User Accounts** as the authentication method. Click **OK**:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image16.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image15.png)

## Configure EntityFramework to work with a MySQL database
Expand All @@ -76,14 +76,14 @@ To complete the steps in this section of the tutorial, you will first need to in

The MVC application that was created from the Visual Studio 2013 template contains a reference to the [EntityFramework 6.0.0](http://www.nuget.org/packages/EntityFramework) package, but there have been updates to that assembly since its release which contain significant performance improvements. In order to use these latest updates in your application, use the following steps.

1. Open your MVC project in Visual Studio 2013.
2. Click **TOOLS**, then click **Library Package Manager**, and then click **Package Manager Console**:
[Click the following image to expand it. ]
1. Open your MVC project in Visual Studio.
2. Click **Tools**, then click **NuGet Package Manager**, and then click **Package Manager Console**:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image18.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image17.png)
3. The **Package Manager Console** will appear in the bottom section of Visual Studio. Type "**Update-Package EntityFramework**" and press Enter:
[Click the following image to expand it. ]
3. The **Package Manager Console** will appear in the bottom section of Visual Studio. Type "**Update-Package EntityFramework**" and press Enter:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image20.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image19.png)

### Install the MySQL provider for EntityFramework
Expand All @@ -94,8 +94,8 @@ In order for EntityFramework to connect to MySQL database, you need to install a
> This is a pre-release version of the assembly, and as such it may contain bugs. You should not use a pre-release version of the provider in production.

[Click the following image to expand it.]
[Click the following image to expand it.]

[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image22.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image21.png)

### Making project configuration changes to the Web.config file for your application
Expand All @@ -110,7 +110,7 @@ In this section you will configure the Entity Framework to use the MySQL provide
2. Locate the following configuration settings, which define the default database provider and factory for the Entity Framework:

[!code-xml[Main](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/samples/sample1.xml)]
3. Replace those configuration settings with the following, which will configure the Entity Framework to use the MySQL provider:
3. Replace those configuration settings with the following, which will configure the Entity Framework to use the MySQL provider:

[!code-xml[Main](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/samples/sample2.xml)]
4. Locate the <connectionStrings> section and replace it with the following code, which will define the connection string for your MySQL database that is hosted on Azure (note that providerName value has also been changed from the original):
Expand Down Expand Up @@ -138,10 +138,10 @@ The MySQL provider that is featured in this tutorial does not currently support

To create a custom Entity Framework initializer for MySQL, use the following steps:

1. Add a new class file named **MySqlInitializer.cs** to the project, and replace it's contents with the following code:
1. Add a new class file named **MySqlInitializer.cs** to the project, and replace it's contents with the following code:

[!code-csharp[Main](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/samples/sample6.cs?highlight=23)]
2. Open the **IdentityModels.cs** file for your project, which is located in the **Models** directory, and replace it's contents with the following:
2. Open the **IdentityModels.cs** file for your project, which is located in the **Models** directory, and replace it's contents with the following:

[!code-csharp[Main](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/samples/sample7.cs)]

Expand All @@ -150,17 +150,17 @@ To create a custom Entity Framework initializer for MySQL, use the following ste
Once you have completed the steps in the preceding sections, you should test your database. To do so, use the following steps:

1. Press **Ctrl + F5** to build and run the web application.
2. Click the **Register** tab on the top of the page:
[Click the following image to expand it. ]
2. Click the **Register** tab on the top of the page:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image4.jpg)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image3.jpg)
3. Enter a new user name and password, and then click **Register**:
[Click the following image to expand it. ]
3. Enter a new user name and password, and then click **Register**:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image24.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image23.png)
4. At this point the ASP.NET Identity tables are created on the MySQL Database, and the user is registered and logged into the application:
[Click the following image to expand it. ]
4. At this point the ASP.NET Identity tables are created on the MySQL Database, and the user is registered and logged into the application:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image6.jpg)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image5.jpg)

### Installing MySQL Workbench tool to verify the data
Expand All @@ -169,11 +169,11 @@ Once you have completed the steps in the preceding sections, you should test you
2. In the installation wizard: **Feature Selection** tab, select **MySQL Workbench** under **applications** section.
3. Launch the app and add a new connection using the connection string data from the Azure MySQL database you created at the begging of this tutorial.
4. After establishing the connection, inspect the **ASP.NET Identity** tables created on the **IdentityMySQLDatabase.**
5. You will see that all ASP.NET Identity required tables are created as shown in the image below:
[Click the following image to expand it. ]
5. You will see that all ASP.NET Identity required tables are created as shown in the image below:

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image8.jpg)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image7.jpg)
6. Inspect the **aspnetusers** table for instance to check for the entries as you register new users.
[Click the following image to expand it. ]
6. Inspect the **aspnetusers** table for instance to check for the entries as you register new users.

[Click the following image to expand it. ]
[![](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image26.png)](aspnet-identity-using-mysql-storage-with-an-entityframework-mysql-provider/_static/image25.png)
Loading

0 comments on commit 701fc69

Please sign in to comment.