Microsoft.mshtml .dll problems... und the solution!!

i developed a winforms application that shows and edits html data.
(for details see older posts)

the control that i use, uses the mshtml library from the Microsoft.mshtml.dll found in the Application Folder of vs2008

"c:\Program Files\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office11\Microsoft.mshtml.dll"
but this dll is ARRGGGH!
following problems:

gacutil /u
uninstall doesnt work on my local machine

gacutil /i
install doesnt work on terminal server without vs2008

cause its delay signed, only public key!

i think that the assembly is installed by MSI Windows Installer
and this adds some info to the registry

1. Download: Primary Interop Assemblies for Office 2003 from msdn
2. then installed the PIA 2003 msi from the packed exe
3. used this dll
4. deploy this dll
everything is fine!

verification of the dlls

\Program Files\Microsoft Visual Studio 9.0\Visual Studio Tools for Office\PIA\Office12>
sn -v Microsoft.mshtml.dll--> Microsoft.mshtml.dll is a delay-signed or test-signed assembly

dll from vs2008 PIA folder
sn -v Microsoft.mshtml.dll
Microsoft (R) .NET Framework Strong Name Utility Version 2.0.50727.42
Copyright (c) Microsoft Corporation. All rights reserved.
--> Assembly 'Microsoft.mshtml.dll' is valid


Zalmoxis said...

Have you tried this with clickonce. Because I have issues with that. I receive the following exception during the clickonce setup.

System.Deployment.Application.InvalidDeploymentException (SignatureValidation)
- Strong name signature not valid for this assembly Microsoft.mshtml.dll.
- Source: System.Deployment
- Stack trace:
at System.Deployment.Application.ComponentVerifier.VerifyStrongNameAssembly(String filePath, AssemblyManifest assemblyManifest)
at System.Deployment.Application.ComponentVerifier.StrongNameAssemblyComponent.Verify()
at System.Deployment.Application.ComponentVerifier.VerifyComponents()
at System.Deployment.Application.DownloadManager.DownloadDependencies(SubscriptionState subState, AssemblyManifest deployManifest, AssemblyManifest appManifest, Uri sourceUriBase, String targetDirectory, String group, IDownloadNotification notification, DownloadOptions options)
at System.Deployment.Application.ApplicationActivator.DownloadApplication(SubscriptionState subState, ActivationDescription actDesc, Int64 transactionId, TempDirectory& downloadTemp)
at System.Deployment.Application.ApplicationActivator.InstallApplication(SubscriptionState subState, ActivationDescription actDesc)
at System.Deployment.Application.ApplicationActivator.PerformDeploymentActivation(Uri activationUri, Boolean isShortcut)
at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

Any help is welcome

Anonymous said...

Hi, people.

I believe that I solved the problem, definitively, for "Strong name signature not valid for this assembly ..."


Pele said...

I have found that the installer for VS2008 (or maybe the SDK I don't know which) added Microsoft.mshtml to the GAC. So rather than downloading the 2003 PIA's to get a signed copy of the assembly you can simply get the copy from the GAC. Then if you explicitly reference this copy of the assembly, your ClickOnce deployment will containt he strong named assembly as well.

.peter.gfader. said...

did you download the PIA's from Microsoft?

Are you sure you did get them with your Vs2008 Install?


Anonymous said...

The next version of c#, should resolve the problem of needing to use the PIA's.

From the New Features in CSharp 4.0 Document

Primary Interop Assemblies are large .NET assemblies generated from COM interfaces to facilitate strongly typed interoperability.

They provide great support at design time, where your experience of the interop is as good as if the types where really defined in .NET.

However, at runtime these large assemblies can easily bloat your program, and also cause versioning issues because they are distributed independently of your application.

The no-PIA feature allows you to continue to use PIAs at design time without having them around at runtime. Instead, the C# compiler will bake the small part of the PIA that a program actually uses directly into its assembly. At runtime the PIA does not have to be loaded.


Andy said...

I found the solution to be if I removed the reference for the Microsoft.mshtml and then manually added the one found at C:\Program Files\Microsoft.NET\Primary Interop Assemblies\Microsoft.mshtml.dll that the strong name issue goes away.

For those who have had the problem saying the mshtml does not exist, it is marked as a prerequiste, but does not auto deploy. You must set the properties of the project under Publish->Application Files to force the mshtml to be included and required for the download. This will cause the 8 MB file to be part of your solution, but makes it work.

Anonymous said...


andre said...

i got a problem with this too:
C:\Program Files\Microsoft.NET\Primary Interop Assemblies\microsoft.mshtml.dll

problem with defragment.
it can not defrag this thing.

is it has to do with microsoft office?
i'm afraid this kind problem has related with updating windows included microsoft office

Peter Gfader said...

Hi andre,

I am not sure what you mean by you cannot "defrag this thing".
Can you explain?


Anonymous said...

I wonder if this issue is also solved by the removal of dependencies on PIA assemblies in .NET/C# 4.0?

Post a Comment

Latest Posts

Popular Posts