简体   繁体   English

在VS2010中更改Web项目中的输出路径

[英]Changing Output path in web project in VS2010

I have several ASP.NET web projects and their Output folder are set to "C:\\Builds\\[ProjectName]bin" (instead of the default "bin\\" folder). 我有几个ASP.NET Web项目,其Output文件夹设置为“C:\\ Builds \\ [ProjectName] bin”(而不是默认的“bin \\”文件夹)。 This makes "F5" Debugging not working because the ASP.NET Development Server expects the "bin" folder under the project folder. 这使得“F5”调试无法正常工作,因为ASP.NET Development Server需要项目文件夹下的“bin”文件夹。

I then changed to use Local IIS Web server (http://localhost/webproject1") and manually updated the vdir physical path to my custom output path. However the VS2010 will not load the csproj because it detects the url is already mapped to a different folder location. 然后我改为使用本地IIS Web服务器(http:// localhost / webproject1“)并手动将vdir物理路径更新到我的自定义输出路径。但是VS2010不会加载csproj,因为它检测到url已经映射到了不同文件夹位置。

I know I probably shouldn't change the Output folder. 我知道我可能不应该更改Output文件夹。 But wondering if there is an easy way to workaround this? 但想知道是否有一种简单的方法来解决这个问题? The goal is to make "F5" debugging work with custom build Output folders. 目标是使用自定义构建输出文件夹进行“F5”调试。


Update due to Aristos' answer: 由于Aristos的回答更新:

Thanks Aristos. 谢谢Aristos。 Unfortunately that won't solve the problem. 不幸的是,这不会解决问题。 All my projects already use the Project Reference, so all the reference dll's are correctly copied to the output folder. 我的所有项目都已使用Project Reference,因此所有引用dll都被正确复制到输出文件夹中。 The reason why F5 debugging does not work is because the output folder is not the normal "bin" sub folder, but in some other path say C:\\BuildsOut\\Foo\\bin . F5调试不起作用的原因是因为输出文件夹不是正常的“bin”子文件夹,而是在其他一些路径中说C:\\BuildsOut\\Foo\\bin

It seems that in order to use F5 to debug the web project in VS2010, it has to use the default Output path "bin". 似乎为了使用F5来调试VS2010中的Web项目,它必须使用默认的输出路径“bin”。 If you change that, then F5 will not work and even worse your project may not even load. 如果你改变它,那么F5将无法工作,更糟糕的是你的项目甚至可能无法加载。

Ian, 伊恩

I have been frustrated by the same problem. 我对同样的问题感到沮丧。 I finally gave up and put this dirty little fix in place. 我终于放弃了,把这个脏小的修复放到位。 I added the following to the "Post-Build" event: 我在“Post-Build”事件中添加了以下内容:

copy "$(TargetDir)MyWeb.dll" "$(ProjectDir)bin"
copy "$(TargetDir)MyWeb.pdb" "$(ProjectDir)bin"

This at least lets me debug the site properly and hit my breakpoints. 这至少让我可以正确调试网站并点击我的断点。

Delete all items in your bin folder for the solution in question, shut down your system and restart. 删除bin文件夹中有关解决方案的所有项目,关闭系统并重新启动。 This fixed it for me at least. 这至少为我修好了。

You place them all on one single solution, you set as the started project your web project, and then you add on your web project the rest dll as reference (right click on web, select on menou "add reference", and automatically gets the latest version of dlls and place them on bin. 您将它们全部放在一个解决方案中,将您的Web项目设置为已启动项目,然后在Web项目中添加其余dll作为参考(右键单击Web,选择on menou“添加引用”,并自动获取最新版本的dll并将它们放在bin上。

Now when you ress F5 if anyone dll project needed is automatic build it, then run the subproject with the new dll inside. 现在当你重新使用F5时,如果需要任何dll项目是自动构建它,那么运行带有新dll的子项目。

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

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