Could not load file or assembly Interop.IWshRuntimeLibrary?

核能气质少年 提交于 2021-02-05 07:48:13

问题


I'm trying to use the iWshRuntimeLibrary. When I 'publish' my app, all is well. When I try to create a setup wizard project however, It builds and installs my project, but shows the following error at launch.

Could not load file or assembly 'Interop.IWshRuntimeLibrary, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

After I click OK, the app seems to proceed as normal.

I've set my project to build against .NET 3.5, if that matters.


回答1:


Solved by following this for iWshRuntimeLibrary:

http://qa.social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/2f3a074b-08c4-4635-ba38-0fd7d04dcb1e

Then this, for wshom.ocx:

http://msdn.microsoft.com/en-us/library/x97ae5d9(v=vs.80).aspx




回答2:


That link doesn't work, here is a cached version for future searchers (http://qa.social.msdn.microsoft.com/Forums/en-US/winformssetup/thread/2f3a074b-08c4-4635-ba38-0fd7d04dcb1e)

Please note: This is a PRODUCTION equivalent (PPE/QA) environment. Please do not expect to get answers from the forums here - or for searches to be reflected in production. To get to the production version of this site, please remove "QA." from the URL.

Error using Interop.IWshRuntimeLibrary in SSIS Script Task 2008 R2 Bids
Error using Interop.IWshRuntimeLibrary in SSIS Script Task 2008 R2 Bids
Can't use IWshRuntimeLibrary in both an app and a dependent assembly?
could not load file or assembly
Could not load file or assembly?
Could not load file or assembly 'Interop.IWshRuntimeLibrary' Windows Forms

ClickOnce and Setup & Deployment Projects

Question

I'm using this library to create shortcuts in a custom action. In the reference, copy local is true. I get this error when I try to install on other computers. Any idea why this would happen? Building on Windows 7, error happens on both Windows 7 and XP. I notice that the file isn't in the Install folder of the target directory when the error happens, but I don't know why because copy local is set to true.

Tuesday, June 22, 2010 4:22 PM

Answers/Replies


Copy local is nothing to do with setup projects. If you want to install that assembly on the client system you must add it to the File System view (in whatever folder is needed) in the setup project.

  • Phil Wilson
  • Marked as answer by ScottyDoesKnow Tuesday, June 22, 2010 6:50 PM
  • Unmarked as answer by ScottyDoesKnow Wednesday, July 14, 2010 12:15 PM

OK it detects all of the other libraries in the custom action project in Detected Dependencies but not this one, and when you go to add assembly it doesn't list COM libraries.

And I have output from the custom action project in the setup, so shouldn't copy local copy it to the file system?


Strange that it doesn't do it automatically, but manually adding the dll file to the Install folder of the user's application folder worked. Thanks Phil.


OK the problem just came up again. The library is added to the setup project, it's in the File System viewer in the Install folder (it's used in a custom install action), and while trying to install to a 32 bit Vista machine it gave the same error saying it couldn't find the file.

Wednesday, July 14, 2010 12:16 PM


Is this an assembly being installed into the GAC? - Phil Wilson


I'll say no, because I don't know how to do that. I just added it to the setup project and put it in the file system viewer in the Install folder.

  • Wednesday, July 14, 2010 6:16 PM

Oh and it only screws up on Vista, XP and 7 work fine.

  • Thursday, July 15, 2010 12:59 PM

Anybody have any clue what's wrong?

  • Monday, July 19, 2010 5:22 PM

In the PrimaryOutput of the Application folder of your setup project add Interop.IwshRuntimeLibrary.dll. Then rebuild your setup project and try running the setup.exe. this worked in my case.. hope this solution helps you too.. Sameer G

  • Friday, June 24, 2011 8:51 AM

sameer,

Application folder means exactly folder? I tried copying the same DLL in %AppData% folder but didn't work ... I am using installshield to create the setup project. Are you suggesting to copy the Interop.IwshRuntimeLibrary.dll include with my setup binaries? please help me




来源:https://stackoverflow.com/questions/8945154/could-not-load-file-or-assembly-interop-iwshruntimelibrary

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!