Please refer to the Introduction to PnP Core Component and OfficeDevPnP.Core for more details. I have created a Console Application and added SharePointPnPCore2016 NuGet package for the SharePoint 2016 version.
Code Snippet
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Microsoft.SharePoint.Client;
  7. using OfficeDevPnP.Core;
  8. using OfficeDevPnP.Core.Extensions;
  9. using Microsoft.SharePoint.Client.Taxonomy;
  10. namespace SP2016PnPCoreComponentDemo
  11. {
  12. class Program
  13. {
  14. static void Main(string[] args)
  15. {
  16. // Input Parameters
  17. string siteUrl = "http://c7395723754/";
  18. string userName = "administrator";
  19. string password = "xxxxxxxxx";
  20. string domain = "AD2012";
  21. string rootFolderRelativeURL = "SitePages/NewHome.aspx";
  22. OfficeDevPnP.Core.AuthenticationManager authMgr = new OfficeDevPnP.Core.AuthenticationManager();
  23. try
  24. {
  25. // Get the client context
  26. using (var ctx = authMgr.GetNetworkCredentialAuthenticatedContext(siteUrl, userName, password, domain))
  27. {
  28. // Set Home Page
  29. ctx.Web.SetHomePage(rootFolderRelativeURL);
  30. }
  31. }
  32. catch (Exception ex)
  33. {
  34. Console.WriteLine("Error Message: " + ex.Message);
  35. }
  36. }
  37. }
  38. }