对于跨多台计算机共享工程推荐C#.NET项目配置 [英] Recommended C# .Net project configuration for sharing project across multiple computers

查看:106
本文介绍了对于跨多台计算机共享工程推荐C#.NET项目配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是唯一的开发人员在一个ASP.Net MVC的项目,但会跨多台计算机在开发过程中共享。我使用VS 2008和将备份对任何颠覆或Git的。我正在寻找关于如何配置项目依赖关系和web.config文件中,以缓解疼痛系统之间的过渡的建议。

我的web.config文件规定,可以在系统之间不同的数据库连接字符串。什么是推荐的方法来推迟该这样,它是特定于开发环境?

我的测试项目依赖于NUnit的,起订量,其他图书馆之间。如果这些库的位置,在整个开发的系统不同,这是否打破参考?如果是这样,我怎么能缓解这一问题?

解决方案
  

我的web.config文件中提供   数据库连接字符串可能   系统之间的差异。什么是   推荐方法推迟这一这样的   这是特定于dev的   环境?

对于App | Web.config中这里是我们做的:

  1. 添加web.config中的svn:忽略
  2. 复制web.config中web.default.config
  3. 添加web.default.config到SVN
  4. 在下面添加到您的BeforeBuild目标
  

 <目标名称=BeforeBuild>
   < CallTarget目标=SetupWebConfig/>
< /目标>
<目标名称=SetupWebConfig条件=!存在(Web.config文件')>
    <复制的源文件=Web.default.configDestinationFiles =Web.config文件/>
< /目标>
 

FWIW,我们也有它删除web.config中,如果构建服务器正在编制的项目,该项目被SetupWebConfig之前调用另一个目标,这允许更改web.default.config包括在内。

您可以得到看中,并自动利用内幕Web.default.config有的正则表达式令牌在Web.config中替换的内容。这也可以捆绑到SetupWebConfig目标。让我知道如果你想看到一个例子。为此,我们设置连接字符串和类似的东西在我们的CI /生成服务器。

  

我的测试项目依赖于NUnit的,   起订量,其他图书馆之间。如果   这些库的位置不同,   在整个开发系统做到这一点突破   引用?如果是这样,我怎么能   缓解这一问题?

我的建议是,包括在你的Subversion / Git仓库的库,将它们放置在一个公共区域,而不是你的项目,这样你可以重新使用它们。使用相对SVN引用它们:外部(记得要设置外部为一个特定的版本号)。此解决您的问题再加上让你对你要使用的每个工具,这是很好的测试和维护发布的产品对分支机构的是什么版本的细粒度控制。

I am the only developer working on an ASP.Net MVC project but will share it across multiple computers during development. I'm using VS 2008 and will back up against either Subversion or Git. I'm looking for recommendations on how to configure the project dependencies and web.config files to ease the pain in transitioning between systems.

My web.config file provides the database connection strings that may differ between the systems. What is recommended method to defer this such that it is specific to the dev environment?

My test project is dependent on NUnit, Moq, among other libraries. If the location of these libraries differs across the dev systems does this break the references? If so, how can I mitigate this issue?

解决方案

My web.config file provides the database connection strings that may differ between the systems. What is recommended method to defer this such that it is specific to the dev environment?

For App|Web.config here's what we do:

  1. Add web.config to svn:ignore
  2. Copy web.config to web.default.config
  3. Add web.default.config to svn
  4. Add the following to your BeforeBuild target

<Target Name="BeforeBuild">
   <CallTarget Targets="SetupWebConfig" />
</Target>
<Target Name="SetupWebConfig" Condition="!Exists('Web.config')">
    <Copy SourceFiles="Web.default.config" DestinationFiles="Web.config" />
</Target>

FWIW, we also have another target which gets called before SetupWebConfig which deletes web.config if the build server is compiling the project, this allows changes to web.default.config to be included.

You can get fancy and automatically replace content in Web.config using a token inside Web.default.config and some regex. This can also be bundled into the SetupWebConfig target. Let me know if you want to see an example. We do this for setting connection strings and similar stuff on our CI/build servers.

My test project is dependent on NUnit, Moq, among other libraries. If the location of these libraries differs across the dev systems does this break the references? If so, how can I mitigate this issue?

My advice would be to include the libraries in your subversion/git repository, place them in a common area, not your project, that way you can reuse them. Reference them using relative svn:externals (remember to set the externals to a specific revision number). This solves your problem plus allows you fine-grained control over what version of each tool you want to use, which is good for testing and maintenance of released products on branches.

这篇关于对于跨多台计算机共享工程推荐C#.NET项目配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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