In the last blogs, we have seen: What is SharePoint modern framework? How to create a webpart & webpart folder structure? How to build a custom web part to the local server and SharePoint modern site?
In this blog, we will see: How to package solution? Deploy your client-side webpart to App Catalog. Install solution on SharePoint Modern site and add the web part to the page.
To use client-side webparts on modern SharePoint server-side pages, you need to deploy and register the webpart with SharePoint. First, you need to package the webpart and then deploy the webpart package to App Catalog in SharePoint site. Let’s go through below steps which are required to add webpart in modern pages.
Name: <<your solution name>>
ID: Unique and Auto-generated according to the webpart.
Version: <<project version>>
IncludeClientSideAssets: Add true if you want to include all assets in package solution.
ZippedPackage: Location where you want your package solution.
3. In the console window, enter the following command to package your client-side solution that contains the webpart:
The command creates the package in the location mentioned in <<zippedPackage>>
3. Above step deploys the client-side solution package. Because this is a full trust client-side solution, SharePoint displays a dialog and asks you to trust the client-side solution to deploy
Select the <<your solution name>> to install the app on the site.
The client-side solution and the web part are installed on your developer site.
The Site Contents page shows you the installation status of your client-side solution. Make sure the installation is complete before going to the next step.
5. On the toolbar, select Save and close to save the page.
Congratulations! You have deployed a client-side webpart to a modern SharePoint page.