Pnp-powershell: Building the project

Created on 15 Apr 2019  Â·  4Comments  Â·  Source: pnp/PnP-PowerShell

I would like to debug a command locally to understand an issue better but am having a hard time getting the project to build successfully.

  • I see that there are builds for both NET 4.5 and dotnet core.
  • Both have a dependency on their respective versions of OfficeDevPnP.Core.

dotnetcore

.NET Framework 4.5

  • SharePointPnP.SharePoint.sln builds successfully.
  • OfficeDevPnP.Core.sln builds successfully.
  • No post build events seem to exist in SharePointPnP.SharePoint.sln.

I assume to debug the commands, I need the build to drop a package in path which PowerShell modules can be loaded. It seems this is what the postbuild.ps1 script does. I havent been able to get anything to show up in _C:\Users\\Documents\WindowsPowerShell\Modules\SharePointPnPPowerShell_.

Any nudge in the right direction would be much appreciated.

All 4 comments

The following procedure for setting up my dev environment did work for me:

  • pull the _PnP-Sites-Core_ repo to a folder
  • pull the _PnP-PowerShell_ repo to the same folder so they reside side-by-side
  • make sure there are no spaces in the path to this folder
  • close any open PowerShell/ISE
  • open _OfficeDevPnP.Core.sln_
  • restore NuGet packages
  • build project _OfficeDevPnP.Core_ - successfully ✅
  • open _SharePointPnP.PowerShell.sln_
  • build project _SharePointPnP.PowerShell.ModuleFilesGenerator_ first - successfully ✅
  • build project _SharePointPnP.PowerShell.Commands_ - successfully ✅
  • open PowerShell ISE
  • the newly built cmdlets now can be used and Visual Studio attached for debugging

Did not have to configure anything else. Windows 10, Visual Studio 2017 & 2019 Preview.

(Once after a PnP update I hade to uninstall all old PnP PowerShell modules, Office 365 CLI and SP Client Components SDK installations because there was an assembly mix-up. Apart from that everything went smoothly and on the first try.)

When I build the assemblies are copied to _C:\Users\\Documents\WindowsPowerShell\Modules\SharePointPnPPowerShellOnline_

Did this on two different machines, worked both times.

Now the question: what's different on your machine?

Confirmed this worked for me after switching all projects to debug16, thru Configuration Manager, as well.

Thank you both for the assistance. Following your steps, everything did build successfully but I still find an empty C:\Users\Documents folder. Now that I know its only on my machine, Ill keep at it and will post an update if I figure it out.

don't think it's only on your machine. Have the same. As far as I understand the compiled cmdlets are copied by post build events. But in my solution (pulled yesterday) no project has any postbuild events. Did they get lost somehow?

Was this page helpful?
0 / 5 - 0 ratings