-
Notifications
You must be signed in to change notification settings - Fork 662
Update your fork with the latest code
Before starting on a Pull Request (PR), ensure your fork is up to date with the upstream dev branch. This will avoid merge conflicts and allow you to create a clean PR with just the changes you are proposing which makes it easier for us to validate and test your submission.
One way to update your fork is to create a simple batch file with the following code in it. Place it in the folder where you have your subfolders PnP-Sites-Core and PnP-PowerShell located, so:
/Sync PnP.bat
/PnP-Sites-Core
/PnP-PowerShell
If you put in the batch file this code, it will sync the master and dev branches of your fork with the ones in the upstream repository and it will compile new versions for the SharePoint 2013, 2016, 2019 and Online builds so you can directly start using it.
cd PnP-Sites-Core
git checkout master
git fetch upstream
git merge upstream/master
git push origin master
git checkout dev
git fetch upstream
git merge upstream/dev
git push origin dev
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\core\OfficeDevPnP.Core.sln /p:Configuration=Debug /property:Platform="Any CPU" /t:"Clean;Rebuild"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\core\OfficeDevPnP.Core.sln /p:Configuration=Debug15 /property:Platform="Any CPU" /t:"Clean;Rebuild"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\core\OfficeDevPnP.Core.sln /p:Configuration=Debug16 /property:Platform="Any CPU" /t:"Clean;Rebuild"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\core\OfficeDevPnP.Core.sln /p:Configuration=Debug19 /property:Platform="Any CPU" /t:"Clean;Rebuild"
cd ../PnP-PowerShell
git checkout master
git fetch upstream
git merge upstream/master
git push origin master
git checkout dev
git fetch upstream
git merge upstream/dev
git push origin dev
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\SharePointPnP.PowerShell.sln /p:Configuration=Debug /property:Platform="Any CPU" /t:"Clean;Rebuild"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\SharePointPnP.PowerShell.sln /p:Configuration=Debug15 /property:Platform="Any CPU" /t:"Clean;Rebuild"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\SharePointPnP.PowerShell.sln /p:Configuration=Debug16 /property:Platform="Any CPU" /t:"Clean;Rebuild"
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe" .\SharePointPnP.PowerShell.sln /p:Configuration=Debug19 /property:Platform="Any CPU" /t:"Clean;Rebuild"
This script assumes you have Visual Studio 2019 Enterprise installed on your environment. If you're using a different Visual Studio version, refer to the following Wikipedia article to find the right MSBuild locations. Ensure you do not have any PowerShell windows open which have the PnP PowerShell module loaded, or the build will fail.
In case you already have done commits to your forked master and/or dev branches, it will throw an error that it can't sync it anymore since the HEAD is ahead of the upstream. In that case you can issue a one time reset to make your fork equal to the upstream again. After that the above script should work again. You can do this reset on your master and dev branches by running:
git fetch upstream
git checkout master
git reset --hard upstream/master
git push origin master --force
git checkout dev
git reset --hard upstream/dev
git push origin dev --force