I'm trying to extend the functionality of MS Access. I want the user to be able to trigger this functionality from within the Access application, ideally through clicking on a button I have introduced. I would like to be able to implement this functionality using C#.
If I was targeting any of MS Word, Excel, Outlook, PowerPoint, Visio, InfoPath, or Project, then Visual Studio Tools for Office (see here) would be ideal for this. However, Access was either never (officially) part of this initiative or was dropped from being officially supported by it quite some time ago. There is a company called Add-In Express that seems to support VSTO with Access, for example, but the license is quite expensive and I would prefer not to have third-party software involved if it can be done directly. There is an MS blog article from 2008 with a hack that takes advantage of the "largely host-agnostic nature of VSTO add-in projects" and converts a Word add-in into an Access add-in. This comes with a caveat:
Note, however, that I'm not encouraging people to use this approach in production – we have not tested this behavior, and it is expressly not supported in any way. What I've done is to explore how VSTO is designed to be optimally host-agnostic, so that the add-in model is as flexible as possible – without going to the extreme of loose typing offered by the old "shared" add-in model.
This approach was suggested in response to this recent SO question and was apparently used successfully by the question asker. While I am concerned by the lack of official support this may suffice for a prototype and I have tried to use it.
After following the steps 1 through 8 without any issues, I hit Debug and MS Access fires up and then throws the following error dialog:
Microsoft Office Customization Installer
There was an error during installation.
Downloading file:///C:/Temp/MyAddIn/bin/Debug/MyAddIn.vsto did not succeed.
Details:
************** Exception Text **************
System.Deployment.Application.DeploymentDownloadException: Downloading
file:///C:/Temp/MyAddIn/bin/Debug/MyAddIn.vsto did not succeed. --->
System.Net.WebException: Could not find a part of the path
'C:\Temp\MyAddIn\bin\Debug\MyAddIn.vsto'. ---> System.Net.WebException:
Could not find a part of the path 'C:\Temp\MyAddIn\bin\Debug\MyAddIn.vsto'.
---> System.IO.DirectoryNotFoundException: Could not find a part of the path
'C:\Temp\MyAddIn\bin\Debug\MyAddIn.vsto'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize,
FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean
bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, FileOptions options, String
msgPath, Boolean bFromProxy)
at System.Net.FileWebStream..ctor(FileWebRequest request, String path,
FileMode mode, FileAccess access, FileShare sharing, Int32 length, Boolean
async)
at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri,
FileAccess access, Boolean asyncHint)
--- End of inner exception stack trace ---
at System.Net.FileWebResponse..ctor(FileWebRequest request, Uri uri,
FileAccess access, Boolean asyncHint)
at System.Net.FileWebRequest.GetResponseCallback(Object state)
--- End of inner exception stack trace ---
at System.Net.FileWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.FileWebRequest.GetResponse()
at
System.Deployment.Application.SystemNetDownloader.DownloadSingleFile
(DownloadQueueItem next)
--- End of inner exception stack trace ---
Googling on "vsto downloading file did not succeed" brought me here and this seemed relevant:
The problem is that the Office application is looking for the deployment manifest (.vsto) and application manifest (.dll.manifest) and is unable to find them.
I searched for a vsto file extension on my machine and the only one found was in my VS solution folder. So I thought perhaps Step 6 from the blog approach was wrong and the last line should be replaced with the path to this vsto file. However this doesn't seem to be the issue.
Then I found this MSDN article on troubleshooting common VSTO issues and Common Error 4 is a match. The "solution" listed is:
This issue is generally seen when the VSTO solution is trying to get certificate information (publisher name and other data) from Domain Controller and it times out. To resolve the issue, please install this hotfix :- KB 981574.
This links here which is a page titled
The splash screen stays open longer than usual when you try to start Excel on a computer that has the .NET Framework 3.5 SP1 installed
which seems compleletly unrelated. Is this a broken link? I'm not sure how to proceed.
