在Windows服务器计算机上重新注册用C#编写的Dll-(安装C#类库) [英] Regisering a Dll written in C# on a windows server machine - (Install a C# Class Library)

查看:130
本文介绍了在Windows服务器计算机上重新注册用C#编写的Dll-(安装C#类库)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为我正在处理的VBA项目编写了一个保存并打开对话框,然后在其中添加链接(感谢@mehow的帮助).

I have written a save and open dialog box add on for a VBA project i'm working on - heres the link VBA: Get Excel FileDialogOpen to point to "My Computer" by default (thanks for the help @mehow).

现在,此添加项(实际上称为类库)可以与我在其上开发它的计算机上的vba项目一起正常工作.但是现在要在服务器上使用此add(类库),我无法成功注册插件,因此VBA项目可以看到它.

Now this add on (Class Library as it is actually called) works fine with the vba project on my computer which Ive been developing it on. However now to use this add (Class Library) on on the server I'm not able to get addon registered successfully so that the VBA project can see it.

我在Windows 8计算机上用VS 2013 Express for Desktop在C#中编写了一个对话框,在C#中添加,现在我们正尝试在Windows Server 2008计算机上对其进行测试,该计算机将在当天结束时运行VBA项目.

I wrote the Dialog box add in in C# with VS 2013 Express for Desktop on my Windows 8 machine and we are now trying to test it on a windows server 2008 machine where the VBA project will run at the end of the day.

我尝试在服务器上使用regsvr32命令以及在VS 2013中寻找部署选项,但似乎都无法正常工作!我还尝试过寻找解决方案,但到目前为止还没有运气.

I have tried using the regsvr32 command on the server as well as looking for a deployment option in VS 2013 but neither seem to be working! I have also tried searching for a solution but no luck so far.

如果任何人对如何做到这一点有任何想法,将不胜感激.抱歉,如果我使用的术语不正确. . .添加插件等,但希望您能理解我的意思.

If anyone has any ideas how this can be done it would be much appreciated. Sorry if i'm not using the correct terminology. . . add ins etc but I hope you get what I mean.

非常感谢

特里斯坦.

推荐答案

在尝试了各种不同的方法之后,我似乎终于可以解决此问题,所以我不确定这是您需要做的,但希望可以将来帮助某人.

I finally seem to have gotten this to work after trying all kinds of different methods so I'm not sure this is all you need to do but hopefully it can help someone in the future.

首先,Visual Studio 2013 Express不包含安装项目",因此您无法在其中创建部署脚本以用于在其他计算机上安装项目,因此必须手动执行.

Firstly, Visual Studio 2013 Express does not include "Setup Projects" so you are not able to create deployment pacages in it for use in installing your project on other machines so you have to do it manually.

然后,您还将需要在目标计算机上使用与用于编写项目时相同的.Net框架-如果您考虑它,但可以进行工作检查,这毫无疑问.

Then you are also going to need the same .Net framework on your target computer as you used to write your project in - this is a no brainer if you think about it but work checking.

所以我复制了.dll.pdb和&来自开发PC上Visual Studio项目bin\Debug文件夹中的.tlb文件,并将它们放入服务器C:驱动器上的文件夹中.

So i copied the .dll, .pdb & .tlb files from the Visual Studio projects bin\Debug folder on my development PC and put them into a folder on the servers C: drive.

然后以管理员身份打开命令提示符(通过右键单击开始菜单中的图标,然后单击以管理员身份运行".然后使用cd C:\Windows\Microsoft.NET\Framework\v4.0.30319文件夹在命令提示符中导航到目标PC的.Net文件夹,您将找到"

Then opened command prompt as administrator (by right clicking on the icon in the start menu and clicking "run as administrator". Then navigate in command prompt to your destination PC's .Net folder by using cd C:\Windows\Microsoft.NET\Framework\v4.0.30319 folder you will find "

一旦我运行了regasm /codebase "C:\MyClassLibraryFolder\MyClassLibrary.dll"regasm /tlb /codebase "C:\MyClassLibraryFolder\MyClassLibrary.dll",这似乎注册了所有内容,并使用MyClassLibrary让我的VBA项目在服务器上运行.

Once there i ran regasm /codebase "C:\MyClassLibraryFolder\MyClassLibrary.dll" and regasm /tlb /codebase "C:\MyClassLibraryFolder\MyClassLibrary.dll" and this seemed to register everything and let my VBA project run on the server using the MyClassLibrary.

从我的阅读中来看regasm是与.Net 4+一起安装的(如果在服务器上的此文件夹中找到了它),并且gacutil似乎不再包括在内,并且当我尝试通过复制在服务器上运行它时它似乎没有任何作用.

From my reading regasm is installed with .Net 4+ (and if found it in this folder on the server) and gacutil seems to be no longer included and when i tried to run it on the server by copying it across it didn't seem to do anything.

如果这不起作用,我也确实运行了这些命令,因此它们可能已添加到在

If this does not work i also did ran these commands so they might have added to the win regtlibv12.exe found at Register type library x64 regtlib which also mentions Regasm /tlb

此链接也很相似使用C#类库在非开发机器上

有关regasm的信息- http://msdn.microsoft.com/zh-cn/library/tzat5yw6%28v=vs.110%29.aspx

希望这会有所帮助.

感谢您的建议.

这篇关于在Windows服务器计算机上重新注册用C#编写的Dll-(安装C#类库)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆