|
| 1 | +# SharePoint Framework development with SharePoint 2016 Feature Pack 2 |
| 2 | + |
| 3 | +SharePoint 2016 Feature Pack 2 support SharePoint Framework client-side web parts in classic SharePoint pages. |
| 4 | + |
| 5 | +Introduction to SharePoint Framework development in SharePoint 2016 Feature Pack is also covered in following video at [SharePoint PnP YouTube Channel](https://www.youtube.com/watch?v=LGLMxnmHk6U&list=PLR9nK3mnD-OXZbEvTEPxzIOMGXj_aZKJG). |
| 6 | + |
| 7 | +<a href="https://www.youtube.com/watch?v=LGLMxnmHk6U&list=PLR9nK3mnD-OXZbEvTEPxzIOMGXj_aZKJG"> |
| 8 | +<img src="../../images/spfx-fp2-youtube-video.png" alt="Screenshot of the YouTube video player for this tutorial" /> |
| 9 | +</a> |
| 10 | + |
| 11 | +## When to use which SharePoint Framework version? |
| 12 | + |
| 13 | +Since SharePoint Online and SharePoint 2016 has different release cycle for the new capabilities, they do support different capabilities also for the SharePoint Framework. SharePoint Online is always using the latest version of the SharePoint Framework, but SharePoint 2016 will support the version, which is matching server-side dependencies of the deployed packages. |
| 14 | + |
| 15 | +SharePoint 2016 Feature Pack 2 has support for the SharePoint Framework client-side web parts hosted in the classic SharePoint pages with SharePoint Framework v1.0. This means that when you are targeting your customization to SharePoint 2016 platform, you'll need to use SharePoint Framework v1.0.2 version due server-side version dependency. |
| 16 | + |
| 17 | +If you are planning to use same client-side web parts in both SharePoint 2016 and in SharePoint Online, you will need to use the SharePoint Framework v1.0.2 as your baseline version to ensure that the web part works in both environments. |
| 18 | + |
| 19 | +## Installing SharePoint Framework version for SP2016 development |
| 20 | + |
| 21 | +You should ensure that you are using the right version of SharePoint Framework in your development machine. You can check the currently globally installed SharePoint Framework Yeoman template package version by executing following command. |
| 22 | + |
| 23 | +``` |
| 24 | +npm list -g --depth 0 |
| 25 | +``` |
| 26 | + |
| 27 | +This will list the globally installed packages, including their versions. You can uninstall newer version by using following command. |
| 28 | + |
| 29 | +``` |
| 30 | +npm uninstall -g @microsoft/generator-sharepoint |
| 31 | +``` |
| 32 | + |
| 33 | +To install v1.0.2 version of the SharePoint Framework Yeoman templates, you can execute following command. |
| 34 | + |
| 35 | +``` |
| 36 | +npm install -g @microsoft/[email protected] |
| 37 | +``` |
| 38 | + |
| 39 | +## Hosting your SharePoint Framework solution for on-premises deployment |
| 40 | + |
| 41 | +Getting SharePoint Framework client-side web parts deployed to on-premises will require two distinct actions. |
| 42 | + |
| 43 | +- Deployment of the solution package to SharePoint app catalog |
| 44 | +- Hosting JavaScript files in centralized ___location |
| 45 | + |
| 46 | +You can host JavaScript files in any suitable ___location for you depending on the environment details. These files can be for example hosted in following locations. |
| 47 | + |
| 48 | +- **Azure CDN** - Similar setup as with SharePoint Online. Does require end users to have Internet connectivity |
| 49 | +- **Local server in corporate network** - Server hosting the JavaScript files for the corporate network. This can be using whatever technology as long as files are accessible with http requests. |
| 50 | +- **SharePoint 2016** - You can also host your files in the local SharePoint farm. You can for example define a standardized site in your farm where all the SharePoint Framework assets are being hosted. Notice though that by default .json files are not allowed to be uploaded to SharePoint 2016 libraries, so farm level settings will need to be adjusted for this option. |
| 51 | + |
| 52 | +> You can find more details on the blocked file types in SharePoint 2016 from following support article: [Types of files that cannot be added to a list or library](https://support.office.com/en-us/article/Types-of-files-that-cannot-be-added-to-a-list-or-library-30be234d-e551-4c2a-8de8-f8546ffbf5b3#ID0EAADAAA=2016) |
| 53 | +
|
| 54 | +## Development environment considerations |
| 55 | + |
| 56 | +When you are developing SharePoint Framework client-side web parts, you should have normally Internet connectivity to access npm packages. This is required when solutions are being scaffold using SharePoint Framework Yeoman templates. |
| 57 | + |
| 58 | +If Internet access is not available for the development machines, you can also setup local on-premises registry for needed npm packages. This does however require additional software and significant amount of work to operation and to update based on new versions and packages in actual npm gallery. |
| 59 | + |
| 60 | +> [Team-based development on the SharePoint Framework](team-based-development-on-sharepoint-framework.md) guidance includes different options around the development environment setup also when you might need to support multiple SharePoint Framework versions. |
| 61 | +
|
| 62 | +## How to determine which SharePoint Framework version was used for a solution? |
| 63 | + |
| 64 | +If you have already existing SharePoint Framework solutions and you'd like to confirm the used SharePoint Framework version for them, you'll need to confirm this potentially from following locations. |
| 65 | + |
| 66 | +- **.yo-rc.json** file in solution root folder defines used SharePoint Framework Yeoman template version when the solution was created. |
| 67 | +- **package.json** file in the solution root folder contains references to versions when the solution was created. |
| 68 | +- **npm-shrinkwrap.json** file in the solution root folder will contain information on the exact versions, if you have used the `npm shrinkwrap` command for the solution to lock-down the exact versions. |
| 69 | +-- **package.json** file in *node_modules\@microsoft/sp-webpart-base* folder contains a *version* attribute matching used SharePoint Framework version, if you have installed packages to your solution. |
0 commit comments