无法打开作为链接添加的configSource文件 [英] Unable to open configSource file that was added as link

查看:222
本文介绍了无法打开作为链接添加的configSource文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的MVC应用程序中,我使用外部配置文件来保持干净的web.config.一些文件很常见,我将它们作为链接从一个位置添加到项目中.对于这些文件,我将复制"选项设置为始终复制",并将这些文件复制到目标文件夹,然后看到它们.但是,当我尝试在浏览器中打开主页时,看到无法打开configSource文件"错误.当我删除文件的链接并仅添加它们(无链接)时,一切正常.您知道什么可能导致此错误吗?

In my MVC application I use external config files to keep clean web.config. Some files are common and I added them to project as link from one location. For those files I set Copy option to Copy always and those files are copied to destination folder and I see them. But when I try to open home page in the browser I see "Unable to open configSource file" error. When I remove links to files and just add them (no link) everything works good. Any idea what may cause this error?

推荐答案

最后,我发现了问题所在.使用始终复制时,文件将复制到bin文件夹.但是,文件是在虚拟目录中而不是在bin中搜索的.因此,我添加了构建后任务,该任务将文件复制到正确的目标位置.

Finally I found what was the issue. When use Copy always, files are copied to bin folder. But files are searched in the virtual directory not in the bin. So I added post build task which copies files to correct destination.

这篇关于无法打开作为链接添加的configSource文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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