Quickly Exporting of Certificates via PowerShell

As I was doing some work with Sitecore Automation Framework, I needed to quickly export certificates from my local store.  Here is the quickest way that I could come up with.

ls | ?{ $_.FriendlyName -match "_SAF$" } | %{ Export-PfxCertificate -Cert $_ -FilePath "C:\<projroot>\infra\configuration\Local\$($_.FriendlyName).pfx" -Password (ConvertTo-SecureString -String "1234" -Force -AsPlainText) }

Maybe there is a nicer way to do that but that’s what comes to mind.


Sitecore 9.0.X Dependency Injection does not use latest Microsoft DI

With all of the excitement with Sitecore 9.X, sometimes it is very tempting to fire up a new project, get the latest NuGet packages and off you go, but there are a few subtle things to remember that Sitecore is embracing rather more niche dependencies and having embracing Microsoft.Extensions.DependencyInjection library from Microsoft is also one of them.

With Sitecore 9.0.X (pre 9.1), Sitecore Dependency Injection mechanism is dependent on on Microsoft.Extensions.DependencyInjection version 1.X.  If you are happen to add NuGet Package with version >2.X then you will get the following awesome message when deploying to the instance:

Method not found: ‘System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)’…

Please beware, to keep the version of dependencies strictly to what is provided by the version of the platform. Review carefully.