使用“调试"和“释放"包含 ASP.NET Web 应用程序的文件夹 [英] Use "debug" and "release" folder with ASP.NET web application

查看:23
本文介绍了使用“调试"和“释放"包含 ASP.NET Web 应用程序的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASP.NET 应用程序,我也想将其用作类库.(这是一个 Castle Windsor 应用程序,带有使用 Windsor 的 WCF 工具的 .svc 文件,但对于任何其他具有 ASPX 页面和一些其他公共类的 Web 应用程序,情况也是一样的.)

I have an ASP.NET application which I also want to use as a class library. (It's a Castle Windsor application with .svc files that use Windsor's WCF facility, but it would be the same situation with any other web application with ASPX pages and some other public classes.)

我实际上想使用类库"或WCF 库"项目模板,因为这允许我选择单独的调试和发布文件夹等.但这不会让我添加 Global.asax 文件.

I actually wanted to use the "class library" or "WCF library" project template as this allows me to choose separate debug and release folders, etc. But that wouldn't let me add a Global.asax file.

所以我切换到了web application"模板,没问题.但是,如果我配置单独的 debug 和 release 文件夹,Web 应用程序将无法运行.

So I switched to the "web application" template, which is OK. However, if I configure separate debug and release folders, the web application won't run.

看起来 Web 应用程序要求程序集直接驻留在bin"目录中,而不是bin\debug"中.

It looks like web applications require the assemblies to reside directly in the "bin" directory, not in "bin\debug".

有没有办法同时实现这两个目标,即在 Visual Studio 中分离构建文件夹和调试支持?

Is there a way to achieve both, i.e. separate build folders and debugging support in Visual Studio?

我不介意在 IIS 中设置本地 Web 应用程序,因此它不必是集成 Web 服务器.

I wouldn't mind setting up a local web application in IIS, so it doesn't have to be the Integrated Web Server.

推荐答案

正如您所发现的,您似乎无法做到这一点,ASP.NET 网站被硬编码为从 \bin 目录.您可以更改项目属性中的输出文件夹并重定向程序集绑定,但最终仍会丢失 DLL.

As you've discovered, it seems you can't do this, ASP.NET websites are hardcoded to run from the \bin directory. You can change the output folder in the project properties and redirect assembly bindings, but you'll still end up with missing DLLs.

查看失败加载的堆栈跟踪,运行时只查看:$(ProjectDir)\bin\assembly.dll$(ProjectDir)\bin\assembly\assembly.dll.

Looking at the stack trace for a failed load, the runtime only looks to: $(ProjectDir)\bin\assembly.dll and $(ProjectDir)\bin\assembly\assembly.dll.

它对 \bin\Debug\bin\Release 文件夹没有兴趣,它们将被忽略.

It has no interest in \bin\Debug or \bin\Release folders and they will be ignored.

这篇关于使用“调试"和“释放"包含 ASP.NET Web 应用程序的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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