Question

I've created a ClickOnce deployment and some of the clients who are installing it are receiving the error:

Unable to install or run the application. The application requires that assembly MSDATASRV Version 7.0.3300.0 be installed in the Global Assumbly Cache (GAC) first.

This is a Microsoft dll and is located in "C:\Program Files\Microsoft.NET\Primary Interop Assemblies" on my build machine and is referenced in my project.

I understand that some of the clients don't have this. I need to find out where this DLL comes from and why its missing from only some of the clients. Since its a Microsoft Dll I cant distribute it myself.

Was it helpful?

Solution

Fairly unlikely you actually need the PIA. Select the MSDATASRC assembly reference and set its Copy Local property to True. You'll now get a copy of Interop.MSDATASRC.dll in your build directory, deploy it along with the rest of your executables.

Do test this. If you now get an InvalidCastException when you test your code then you do need the PIA deployed on the user's machine. You cannot do this with ClickOnce, you have to ask the user to install it himself. Downloading and installing an Office PIA gets that done. You'll also strongly want to consider updating your VS version, VS2010 and up support the Embed Interop Types option, otherwise known as the "No PIA" option.

OTHER TIPS

I had same error when I forgot change solution configuration from "Debug" to "Release" in the Visual Studio.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top