SOLVED

PnP PowerShell - troubleshooting cmdlet authoring

Copper Contributor

I believe this is a question for @Erwin van Hunen, but any help is appreciated!

 

I'm working on creating a new cmdlet for PnP to allow the addition of Image Renditions to SharePoint. I've created the Core method in C# and it's compiled and tested successfully from a console app.

 

I then added the cmdlet to the PowerShell solution, but am experiencing something odd during my testing. I'm guessing it's something I'm doing wrong, but I've not been able to figure out what the issue is and would appreciate some guidance. I'm pretty sure my references are all correct and I'm importing the correct module, but I could be wrong. I've also closed and reloaded new PowerShell sessions throughout my troubleshooting.

 

The screenshot below is taken after building the Core and PowerShell solutions, then importing the updated module that contains my new cmdlet. My cmdlet name is "Add-PnPPublishingImageRendition." You can see that immediately after I import the module, the cmdlet is listed. However, if I then attempt to use the cmdlet (with or without parameters), I'm told it's not a cmdlet. Following that with another "Get-Command," you can see that my cmdlet is gone. Where'd it go? What am I doing wrong?

 

pnp-2016-12-23_22-00-11.png

 

 

1 Reply
best response confirmed by Eric Skaggs (Copper Contributor)
Solution

FIXED - run Visual Studio as an admin!

I was not running Visual Studio as an Administrator. I closed everything and re-opened "as an Administrator" and now my cmdlet is sticking around and works. Frustrated, but happy. :)

1 best response

Accepted Solutions
best response confirmed by Eric Skaggs (Copper Contributor)
Solution

FIXED - run Visual Studio as an admin!

I was not running Visual Studio as an Administrator. I closed everything and re-opened "as an Administrator" and now my cmdlet is sticking around and works. Frustrated, but happy. :)

View solution in original post