我如何在我的web.config摆脱单元测试relicts的? [英] How do I get rid of Unit Testing relicts in my Web.config?

查看:294
本文介绍了我如何在我的web.config摆脱单元测试relicts的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

虽然我目前的项目上传到我们的临时服务器我发现我的Asp.net MVC框架的Web.config文件包含组件叫一些参考

While uploading my current project to our staging server I noticed that the Web.config file of my Asp.net MVC framework contains some references to assemblies called


  • Hostadapters.AspNetAdapter

  • QualityTools.Common

  • QualityTools.ExecutionCommon

  • QualityTools.Resource

我还没有添加条目自己,但是从他们的名字猜测,我怀疑这些已经被添加了添加单元测试向导。

I have not added the entries myself, but guessing from their names, I suspect these have been added by the "Add Unit Tests" Wizard.

问题是,与被引用这些程序集,该项目不我临时服务器上运行,因为它无法找到相关的DLL。其路径是硬coded到
Web.config文件:

The problem is, with these assemblies being referenced, the project does not run on my staging server, because it can't find the relevant DLLs. Their paths are hard-coded into the Web.config:

<httpModules>
  <add name="HostAdapter" type="Microsoft.VisualStudio.TestTools.HostAdapter.Web.HttpModule, Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</httpModules>


  <dependentAssembly>
    <assemblyIdentity name="Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
    <codeBase version="10.0.0.0" href="file:///C:/Program%20Files%20(x86)/Microsoft%20Visual%20Studio%2010.0/Common7/IDE/PrivateAssemblies/Microsoft.VisualStudio.QualityTools.HostAdapters.ASPNETAdapter.DLL" />
  </dependentAssembly>

我在想,这些组件是单元测试相关的纠正?

Am I correct in thinking that these assemblies are Unit-Testing-Related?

当我试图删除一些条目,服务器传回错误403访问被拒绝:禁止。什么可能是这个意思,我怎么能避免呢?

When I tried to remove some of these entries, the server responded with an error 403 "Access Denied: Forbidden." What might be the meaning of this, and how can I avoid it?

我可以简单地上传某处所引用的DLL文件到服务器上,但似乎违反直觉。我是否有其他选择?

I could simply upload the referenced DLL files somewhere onto the server, but that seems counter-intuitive. Do I have other options?

编辑:我看过的建议,配置分割成独立的部分。这是一个很好的建议,但它并不能帮助我与我的如何赫克我能得到眼前的问题的任何的配置在服务器上的工作吗?

I have read the suggestion to split configuration into separate parts. It is a good suggestion, but it doesn't help me with my immediate problem of how the heck do I get any configuration working on the server?

推荐答案

我会分期单独的web.config文件中,生活不分。

I would have separate web.config files for staging and live regardless.

有哪些需要改变为发展宗旨,例如频繁的许多设置缓存的长度,安全设置,网址等。

There are frequently many settings which need changing for development purposes, e.g. Cache lengths, security settings, urls etc.

从我的经验,采用了相同的配置是一个灾难 - 它需要1开发者改变设置,以获得一些本地工作,然后检查更新的文件,并且你结束了一个破碎的临时服务器(或可能生活)!

From my experience, using the same config is a recipe for disaster - it takes 1 developer to change the settings to get something working locally, and then check the updated file in, and you end up with a broken staging server (or possibly live)!

如果你使用一个构建那么很简单构建过程中替换与web.live.config或web.staging.config web.config中。

If you use a build then it is simple to substitute web.config with web.live.config or web.staging.config during the build process.

然后,您的问题消失。

这篇关于我如何在我的web.config摆脱单元测试relicts的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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