Installing Office Customization

2019-02-02 20:26发布

Name: From: file:///D:/Samples/TestUpdatedVersion/bin/Debug/TestUpdatedVersion.vsto

The customization cannot be installed because another version is currently installed and cannot be upgraded from this location. To install this version of the customization, first use Add or Remove Programs to uninstall this program: TestUpdatedVersion. Then install the new customization from the following location: file:///D:/Samples/TestUpdatedVersion/bin/Debug/TestUpdatedVersion.vsto

************** Exception Text ************** Microsoft.VisualStudio.Tools.Applications.Deployment.AddInAlreadyInstalledException: The customization cannot be installed because another version is currently installed and cannot be upgraded from this location. To install this version of the customization, first use Add or Remove Programs to uninstall this program: TestUpdatedVersion. Then install the new customization from the following location: file:///D:/Samples/TestUpdatedVersion/bin/Debug/TestUpdatedVersion.vsto at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.VerifySolutionCodebaseIsUnchanged(Uri uri, String subscriptionId, Boolean previouslyInstalled) at Microsoft.VisualStudio.Tools.Applications.Deployment.ClickOnceAddInDeploymentManager.InstallAddIn()

9条回答
Evening l夕情丶
2楼-- · 2019-02-02 21:06

This error should only occur on your development machines.

From Microsoft's Troubleshooting guide for office deployments (http://msdn.microsoft.com/en-us/library/bb608594.aspx):

When you build an Office solution, the built version is automatically registered. If you have previously published and installed the same solution to your development computer, Visual Studio Tools for Office runtime detects that the installation path for the published version and the built version are different after the next build, rebuild, or publish. The error message says "the customization cannot be installed because another version is currently installed and cannot be upgraded from this location." Because rebuilding the solution updates the registry keys, it is necessary to uninstall the first version before publishing, debugging, or running the second version.

To prevent the message from appearing, create another user account on your development computer to test your deployment. Alternatively, you can uninstall the version from the list of installed programs on the computer before you next publish, debug, or rebuild the solution.

查看更多
来,给爷笑一个
3楼-- · 2019-02-02 21:09

I was testing deployment after making the addin setup and facing the same problem when trying to install.

Issue: When you do a publish or debug the addin, VS would create/update the registry with this addin info under

HKEY_CURRENT_USER\Software\Microsoft\Office\Excel\Addins\<you addin name>\Manifest

this has the reference to the VSTO file that would be compared for doing upgrade. In your case, after you do publish, it would be pointing to

file:///D:/Samples/TestUpdatedVersion/bin/Debug/TestUpdatedVersion.vsto

Change this to your published vsto path. Now try to install, should work fine. You can test your auto upgrade options the same way, i.e. make a build+publish and change this path, then close all excels and open one.

查看更多
手持菜刀,她持情操
4楼-- · 2019-02-02 21:12

Try uninstalling the previously installed VSTO application OR from the visual studio menu > Build | Clean Solution.

查看更多
Melony?
5楼-- · 2019-02-02 21:25

I had the same problem when deploying a new version of our VSTO word addin. After fiddling for 2 hours I found out that the Installation folder URL that you set in the properties of the solution (where it upgrades from) is case sensitive and stupidly needs to be the same case as the initial installation URL.

查看更多
ら.Afraid
6楼-- · 2019-02-02 21:29

This error can show up if you are trying to install/update a VSTO AddIn on the same machine where you've developed it, and it's caused by Visual Studio.

Whenever you build your AddIn in Visual Studio, it updates the registry key used by the AddIn thus breaking any install that you've done.

HKEY_CURRENT_USER\Software\Microsoft\Office\<Application>\Addins\<YourAddIn>\Manifest

The solution is to add a post-build event that would restore/set the registry key to the correct value. For example, if your AddIn is configured to be installed/updated from <YourPublishLocation>, the post-build event should be similar to:

REG ADD "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\<Application>\Addins <YourAddIn>"
/v "Manifest" /d "<YourPublishLocation>" /f
查看更多
The star\"
7楼-- · 2019-02-02 21:29

On development machine, on which I had built the VSTO Project in Visual Studio with the same Product Version / identity, I needed to execute Clean command by selecting the Project in Solution Explorer. In fact, this helped clear the registry entry, referred to above.

That allowed me to re-install the product with same application identity

查看更多
登录 后发表回答