I'm in the process of learning how to create add-ins for Microsoft Office Word. I've created a simple Word 2010 Add-In project in Visual Studio 2010 which displays "Hello World" in a message box. Up to this point everything works fine. But if I want to change the message for instance from "Hello World" to "Hi" i get the following error message
System.Deployment.Application.DeploymentException: Unable to install this application because an application with the same identity is already installed. To install this application, either modify the manifest version for this application or uninstall the preexisting application.
After installing the add-in I do the following:
Remove the add-in from Ms Word Options,Add-Ins
Uninstall the add-in from Add Remove Programs
Delete the Normal.dot file
Delete the .vsto in my bin/Debug folder of the project
Once I re-run the project I get the error above.
I really don't know where else can this plug in exist as I think I delete all possible places where any references to it could be found.
I've also tried running RegScanner and deleting all the registry entries pertaining to the add in,yet im getting the same error...
If anyone had this issue before and you know exactly how to solve it and what could be causing it please let me know!
I discovered that if you modify any code in a MS Word Add-in in Visual Studio and you want your changes to be updated in MS Word you can do the folowing:
In Visual Studio,change the version number in Project Name\Properties\Publish\Publish Properties.
Once the version number has been changed (e.g 1 0 0 1) rebuild the project in Visual Studio.
Navigate to ProjectFolder\bin\Debug and double click the .vsto file, voila! You get the following message - The Microsoft Office customization was successfully updated.If you view the .vsto file with a text editor you can also see that the version number has been changed to a new value,hence an update occurs when you double click the .vsto file.It picks up a new version number and re-installs the add-in and successfully attaches to Word.
If the above is the accepted way to do it, that's fine, but I would still like to know whether there is any way that an add-in can be automatically updated in Word without changing the version number.Simply change code,rebuild project,install.
Related
I have successfully coded a little application level add-in for Excel in C# in Visual Studio. But I seem to struggle with the deployment.
I have tried the ClickOnce and Windows Installer variants and they work fine, but not the way I wanted: I would like to be able to install my Add-in though the "Developer" Tab in Excel by pressing "COM Add-Ins" and then "add..."
But Excel says:
It doesn't recognize neither the .dll nor the .vsto nor the setup.exe files as a valid Addin.
Screenshots for reference https://imgur.com/a/Bj6Vf
How can I compile my code that Excel recognizes it?
It seems like I'm missing a step here and I couldn't find any solutions for this online, so I thought I could ask you for help.
I have completed making a word document in visual studio which I would like to be able to install easily on a number of computers. I am unsure as to how I am supposed to create an installer.I tired using just the build release( which contains the setup, the document itself, the vsto file and a folder called application files)and this worked to an extent but it does not allow me to install on computers without unblocking all the elements in the release and even then only works about half the time. I tried using the instructions found here https://msdn.microsoft.com/en-us/library/ff937654.aspx which worked well for me earlier when creating an outlook Add-In however the final result of this was just a setup and a windows installer without and document to use. The document does reside in bin\release and works there however, when i remove it from this folder it no longer works. What am I doing wrong and how should I proceed?
You could add the Word document to a VS Project as a resource (Build Action).
Upon application start, save the resource to a temporary file and open it.
The Application could be published using click once deployment.
I have an office add-in (vsto) that has been working fine for ages.
It launches perfectly, runs nicely no problem, but this is only when debugging from visual studio.
If I now take the files from my bin\debug and move it to another folder, then I register the released version
c:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm.exe "C:\Program Files (x86)\MyPlugin\MyVSTO.dll"
it registers correctly, but will not load in office.
I have tried retricking the registry setting "LoadBehavior" setting it back to 3, but no luck.
office keeps complaining about my add in with the error
"Not loaded. A runtime error occured during loading of a com add in"
So it seems like it is dying when trying to launch. I though there was a missing dll or something, but no such luck, every library i need is in the folder.
This is the exact same machine so shouldnt be a dot net issue
fyi
This is done in C# 4.0 using netOffice
You can not install an Excel add-in using REGASM because it does not setup all required information; you need to deploy your add-in as per MSDN office deployment guidelines, you have two choices:
Click once
Windows installer
Note: VS actually installs the Add-in for you by setting the right information In Excel and the registry, so that you do not need to deploy the add-in manually for every new build.
I have made an Excel Add in (Ribbon).
When i run the .vsto and install it, i've one installation under Programs in Windows.
But, when I open my Excel program, another installation appears in the Programs-list.
Why is that and it shouldn't be like that right?
Update:
I notice in Application I have set Target framework: ".NET Framework 4 Client Profile"
and in Publish - Prerequisites it adds a Microsoft .NET Framework 4 Client Profile(x86 and x64), has that anything to do with it?
This can happen when you install the VSTO on your development computer. This is because when debugging the VSTO it will get installed though it won't show in the Programs & Features list. The VSTO will remain installed even after debugging is stopped. Even when performing a proper installation, remnants of the debugged VSTO will remain in the registry.
I've found the best way to work around this (though not ideal) is to manually remove the registry key at this location before performing a proper installation:
HKEY_CURRENT_USER\Software\Microsoft\Office\Word\Addins\[YOUR VSTO PROJECT NAME]
Because maybe in configuration you have set the application to update itself automatically.
So after Excel startup, it tryes to auto-update.
Is it possible?
It is very common to find two instances of the same add-in on your Excel application in a development machine. Since you must be building that add-in code inside your IDE before publishing or making a setup project build.
Whenever Excel starts it automatically detects the add-in manifests that are present on your computer.
Since you also installed your add-in your machine now has two locations where it finds your add-in one in your project folder and another at the location where you have installed the add-in.
So excel will, on its own add two add-ins because it found two add-ins, as simple as that.
And it has nothing to do with your Publish pre-requisites and Target framework.
You can simply go to FIlE->Options->Add-Ins-> over here in the window you'll find a Drop down with the label saying "Manage", in that select COM Add-ins and click on 'GO'.
Now in the window that opens, you'll find both your plug-ins listed there, you can remove the plugin that you do not want to see on your Excel app.
But, anyways the next time you build your excel add-in and start Excel it will again add that add-in automatically to your Excel app.
So it would be better not to install the add-in which you make on your machine until you want to test the installer or something like that.
I'm trying to deploy Outlook add-in with ClickOnce.
While setting the update options I noticed that there are fewer options available for Outlook add in project than there are for Win Forms project. For example I cannot specify minimum required version. Why is that? Also, I would like:
to enable manual update
to ask user if he even wants an update (if it is not required).
1) I tried using System.Deployment.Application and CheckForDetailedUpdate() function but even though update succeeds there are problems installing it: If i restart my plugin it disappears from Outlook, if I don't the old version gets stuck in Outlook (and behaves oddly) although further updates via UNC path suggest that update has been successfully done.
2) Regular publish with no special options added with Mage or MageUI works in itself, but add-in seems to update without asking a user. Googling a bit reveils that people are trying to do the opposite, so I'm kind of puzzled as to why doesn't it prompt for update by default.
I tried editing manifests generated from Visual Studio with MageUI but it generates invalid XML for application manifest (?! - it misses "assemblyIdentity" node in "dependentAssembly" node), and when i add missing nodes from original manifest generated by VS (and update and sign it afterwards), installation complains about assembly hashes being invalid.
How can I deploy Outlook add-in with said requirements?
VSTO applications (Office Add-Ins) only support certain bits of ClickOnce. You can try adding code and doing programmatic updates, but the ClickOnce lead at Microsoft said it is not really intended to be used, and parts of it might not work. (No, no details on exactly which parts -- you have to do a bit of trial & error).
Also note that the way a vsto deployment works and runs is this: Outlook checks out the vsto app, and copies the dll(s) to a shadow location and loads that with Outlook. When you update the vsto app, it updates it in the click once cache, but not in outlook. When you close outlook and re-open it, it finds the new version, copies it out to the shadow location, and loads it. You can't restart the vsto bit itself and have it do anything. The user must restart Outlook.
This is one of the reasons that updates are performed when starting up the Office application. It looks for the new version, updates if necessary, and then loads it into Outlook and uses it.
Having said that, another way to accomplish what you want is to write a windows forms app that will update your add-in. Basically deploy a winforms app that just shows nothing the first time except invoke the vsto application via clickonce (process.start is your friend). Then you could have the outlook add-in invoke the winforms app the see if there's an update, and if there is, it could prompt for an update of the win forms app, and then uninstall and reinstall the office add-in or update it.