You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/blazor-build-reusable-components/1-introduction.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ metadata:
5
5
unitType: introduction
6
6
title: Introduction to Razor class libraries
7
7
description: "By using Razor class libraries, you can share user-interface components between ASP.NET Core and Blazor applications. You package the components using NuGet and other applications can easily reference them."
Copy file name to clipboardExpand all lines: learn-pr/aspnetcore/blazor-build-reusable-components/includes/5-nuget-package.md
+12-12Lines changed: 12 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,7 +8,7 @@ In this unit, you update that project and generate a NuGet package. Finally, you
8
8
9
9
Begin by updating the *FirstClassLibrary* project with properties that allow it to be packaged for deployment as a NuGet package.
10
10
11
-
1. Open the project file for the *MyClassLibrary* project. Either double-click the project in Visual Studio Solution Explorer or open the *MyClassLibrary.csproj* file in Visual Studio Code.
11
+
1. Open the project file for the *FirstClassLibrary* project. Either double-click the project in Visual Studio Solution Explorer or open the **FirstClassLibrary*.csproj* file in Visual Studio Code.
12
12
1. Near the top of the file, in the section with the `<PropertyGroup>` tag, add the following content before the closing `</PropertyGroup>` tag:
13
13
14
14
```xml
@@ -28,45 +28,45 @@ Next, you run the .NET command at the command line to package the Razor class li
28
28
29
29
You can run these same steps in your continuous integration process to package a library and deploy it to NuGet.org, a GitHub repository, or another location for your organization to share.
30
30
31
-
In the same folder as the *MyClassLibrary.csproj* file, run the following command:
31
+
In the same folder as the *FirstClassLibrary.csproj* file, run the following command:
32
32
33
33
```dotnetcli
34
34
dotnet pack
35
35
```
36
36
37
-
This command writes a file named *My.FirstClassLibrary.0.1.0.nupkg* to your *bin/Debug* folder.
37
+
This command writes a file named *My.FirstClassLibrary.0.1.0.nupkg* to your *bin/Release* folder.
38
38
39
-
## Add a reference to the NuGet package in the MyBlazorServer application
39
+
## Add a reference to the NuGet package in the MyBlazorApp application
40
40
41
-
You already referenced the *FirstClassLibrary* project in your MyBlazorServer application, because it was in the same folder structure as the web application.
41
+
You already referenced the *FirstClassLibrary* project in your MyBlazorApp application, because it was in the same folder structure as the web application.
42
42
43
43
Now, you undo that project reference and add a reference to the NuGet package that you created earlier.
44
44
45
45
The following steps *don't* describe a typical configuration. Library projects that reside in the same folders or solution as the applications that want to reference them can reference the project directly, as you saw in the earlier exercise.
46
46
47
-
1. Open the *MyBlazorServer.csproj* file either by double-clicking the *MyBlazorServer* project name in Visual Studio or by opening the file in Visual Studio Code.
48
-
1. In the *MyBlazorServer.csproj* file, remove the following line:
47
+
1. Open the *MyBlazorApp.csproj* file either by double-clicking the *MyBlazorApp* project name in Visual Studio or by opening the file in Visual Studio Code.
48
+
1. In the *MyBlazorApp.csproj* file, remove the following line:
This command grabs the NuGet package that you created earlier, installs a copy in your local NuGet package cache, and then adds a reference to that package in the *MyBlazorServer.csproj* file.
58
+
This command grabs the NuGet package that you created earlier, installs a copy in your local NuGet package cache, and then adds a reference to that package in the *MyBlazorApp.csproj* file.
59
59
60
60
## Check your work
61
61
62
62
Did your new package install properly? Can you start the FirstServer application and see a modal window when the application starts?
63
63
64
64
Let's find out:
65
65
66
-
1. Start the MyBlazorServer application either in Visual Studio, by selecting F5, or in the MyBlazorServer folder, by running the following command:
66
+
1. Start the MyBlazorApp application either in Visual Studio, by selecting F5, or in the MyBlazorApp folder, by running the following command:
67
67
68
68
`dotnet run`
69
69
70
-
1. In your browser, go to the home page of the MyBlazorServer application: ``` https://localhost:5000 ```.
70
+
1. In your browser, go to the home page of the MyBlazorApp application: ``` https://localhost:5000 ```.
71
71
72
72
Is the **My first Modal dialog** dialog displayed? If so, congratulations! You successfully packaged and deployed the *FirstClassLibrary* project correctly. Applications everywhere can now use your modal window component by referencing your newly created NuGet package.
0 commit comments