InPlaceHostingManager: Why Does AssertApplicationRequirements() Throw a TrustNotGrantedException?

As you may remember, InPlaceHostingManager is a part of the ClickOnce API that enables a .NET application to download and install other ClickOnce applications. It's pretty straightforward to use - but there may be one area that trips you up.

I was chatting in email with an MVP about why his InPlaceHostingManager application was throwing a TrustNotGrantedException from AssertApplicationRequirements(). As it turns out, he had missed one of the requirements for using InPlaceHostingManager: all applications you install must be signed using a certificate that is installed on the local machine as a trusted publisher.

This requirement is discussed in the main doc page for InPlaceHostingManager. However, I currently do not doc this exception as being generated by AssertApplicationRequirements(). So it's no wonder that people aren't picking up on this. This doc error will be fixed in the next doc build. Until then, consider yourself advised.

For more about trusted publishers, check out Brian Noyes' excellent article on the subject. (Yes, his article is better than my docs. I'll be correcting this soon.)