"新增为链接"对于JavaScript文件返回404调试 [英] "Add as Link" for JavaScript files returning 404 in debug

查看:138
本文介绍了"新增为链接"对于JavaScript文件返回404调试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用Visual Studio 2010的ASP.net web应用程序,我有一个共享一些JavaScript / CSS文件的几个项目。对于他们分享这些文件的最合理的方式是将文件放在一个文件夹,每个项目已列入他们的添加为链接选项。不过,如果我添加文件时,我要么使用Visual Studio开发服务器调试或使用本地IIS Web服务器调试这种方式对这些文件的所有请求返回404未找​​到错误。如果我发布网站,然后将文件复制但这显然不调试帮助。

Using a Visual Studio 2010 ASP.net web application, I have several projects that share some JavaScript/css files. The most logical way for them to share these files is to place the files in a single folder and each project has them included with the "Add as Link" option. However, if I add the files this way when I'm debugging using either the Visual Studio Development server or debugging using a local IIS web server all requests for these files return 404 Not Found errors. If I publish the site then the files are copied but that obviously doesn't help with debugging.

有什么我失踪,或者这是在VS的一部分失败?

Is there something I'm missing or is this a failing on VS's part?

推荐答案

要解决这个问题,前一段时间我创建了一个<一个href=\"https://www.nuget.org/packages/MSBuild.WebApplication.CopyContentLinkedFiles/\">MSBuild.WebApplication.CopyContentLinkedFiles'的NuGet包。这个包增加了其复制所有内容的文件添加为纽带构建过程中,项目文件夹中的MSBuild目标。

To overcome this problem some time ago I created a 'MSBuild.WebApplication.CopyContentLinkedFiles' nuget package. This package adds MsBuild target which copies all content files added as link to project folder during build.

注意的:如果你使用源代码控制,然后最好是添加复制的文件(从Web应用程序文件夹中)忽略列表

Note: if you use source control then it is better to add copied files (from Web Application folder) to ignore list.

这篇关于&quot;新增为链接&QUOT;对于JavaScript文件返回404调试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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