简体   繁体   English

将DLL附加到ASP.NET站点

[英]Attach DLL to ASP.NET Site

How do you attach a dll to a asp.net site? 你如何将一个DLL附加到asp.net网站? I want to be able to debug and edit the dll without having to keep replacing the reference in my asp.net site. 我希望能够调试和编辑DLL,而不必继续替换我的asp.net站点中的引用。 I checked attach to process but didn't see the worker process. 我检查了附加到进程,但没有看到工作进程。 I am using asp.net, iis 7. 我使用的是asp.net,iis 7。

Just put it into /bin folder of your web application. 只需将其放入Web应用程序的/ bin文件夹即可。

OR 要么

Add reference to this .dll by right clicking on References > Add Reference > Browse > Select your .dll file and lick OK. 通过右键单击References > Add Reference > Browse >选择您的.dll文件并单击确定,添加对此.dll的References > Add Reference > Browse >

Then set it's "Copy Local" property to "True". 然后将其“复制本地”属性设置为“True”。 This way .dll will be copied into /Bin folder each time you build application. 这种方式.dll将在每次构建应用程序时复制到/ Bin文件夹中。

alt text http://xmages.net/out.php/i170817_1.png alt text http://xmages.net/out.php/i170817_1.png

Using Visual Studio you should create a Solution that has your website as a project and the DLL (code) as another project. 使用Visual Studio,您应该创建一个解决方案,将您的网站作为项目,将DLL(代码)作为另一个项目。 Make a reference in the Website project to the DLL project and it should update it automatically. 在网站项目中引用DLL项目,它应该自动更新它。

If you are not using the Web Application model and just the Website model you could just have your DLL project output to your website's /bin directory directly. 如果您不使用Web应用程序模型而只使用网站模型,则可以直接将DLL项目输出到网站的/ bin目录中。 That will update the DLL in the website/bin folder whenever you build your DLL project. 这将在您构建DLL项目时更新website / bin文件夹中的DLL。

If I could suggest, because I still use it, go to LearnVisualStudio.com and check out the free video's. 如果我可以建议,因为我仍然使用它,去LearnVisualStudio.com查看免费视频。

If you want to edit the dll, open that project up in a second instance of Visual Studio and treat it like you would for any other project. 如果要编辑dll,请在Visual Studio的第二个实例中打开该项目,并像对待任何其他项目一样对待它。

Set the reference in your /bin folder to the debug dll that the second Visual Studio creates. 将/ bin文件夹中的引用设置为第二个Visual Studio创建的调试DLL。

I'm assuming you have Visual Studio... 我假设你有Visual Studio ...

If you're just trying to add a dll, you can add a reference to it by right clicking on your website node and choosing "Add Reference..." . 如果您只是尝试添加dll,可以通过右键单击网站节点并选择“添加引用...”来添加对它的引用。 You will be able to debug the dll if you have its pdb along with it (to load the symbols from). 如果你有pdb,你可以调试dll(从中加载符号)。 You will NOT be able to edit the dll. 您将无法编辑dll。

If the dll is in fact another project you have the source code for, just add the project to your solution, and from your website project add a reference from the "projects" tab. 如果dll实际上是您拥有源代码的另一个项目,只需将项目添加到您的解决方案中,并从您的网站项目添加“项目”选项卡中的引用。 VS should add a reference and dependency so that it keeps the dll updated when you change code in your dll project. VS应添加引用和依赖项,以便在更改dll项目中的代码时保持dll更新。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM