怎样才能有开发商对VS2008目标.NET 2.0(而不是服务包),以避免运行时崩溃? [英] How does one have developers on VS2008 target .net 2.0 (but not the service pack) to avoid runtime crashes?

查看:127
本文介绍了怎样才能有开发商对VS2008目标.NET 2.0(而不是服务包),以避免运行时崩溃?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我想我的开发团队升级到VS2008。作为一个企业,我们还没有推出的3.5运行时呢。

So, I want to upgrade my development team to VS2008. As an enterprise, we haven't rolled out the 3.5 runtime yet.

这是一些阅读,这似乎是安装VS2008会自动给你.NET 2.0 SP1,里面有一些新的API,而当你的目标2.0运行时,它会假设2.0 SP1。

From some reading, it seems like installing VS2008 will automatically give you .net 2.0 SP1, which has some new APIs, and when you target 2.0 runtime it will assume 2.0 SP1.

但是,如果SP1未推出给我们的用户,这将导致运行中断。

But if SP1 is not rolled out to our users, this will lead to runtime breaks.

  1. 反正是有有VS目标DOTNET 2.0(不SP1)?
  2. 还有没有其他办法解决这一问题,让开发人员不使用该编译API和本地运行正常,但炸毁生产?

我看到的FxCop具有这样的检查,但必须有一个更傻瓜型的解决这个问题。

I see that fxcop has a check for this but there must be a more fool-proof solution to this problem.

推荐答案

这可能是困难或容易。我们去了两条路线:

This can be difficult or easy. We went both routes:

  1. 最简单的办法:建立一个构建服务器只安装了.NET 2.0。自动生成到在办理入住手续(我们使用CruiseControl.Net)运行。你将不得不使用的MSBuild从命令提示符来构建项目。

  1. The easy way: Establish a build server that has only .Net 2.0 installed. Automate the build to run on check-in (we use CruiseControl.Net). You will have to use MSBuild from the command-prompt to build the projects.

有关安装了很多的MSBuild的工具,即使你从.NET 2.0框架目录中运行的MSBuild被替换机3.5。为了避免这种情况,你必须创建一个强制继续使用只有NET 2.0运行时的应用。这是不容易的。我们直接加载的项目及使用Microsoft.Build调用的构建。*框架。仅凭这一点还是不够的。你必须针要在config文件使用组件:

For machines with 3.5 installed many of the MSBuild tools are replaced even when you run the MSBuild from the .Net 2.0 framework directory. To avoid this you must create an application that forces the continued use of the .Net 2.0 runtime only. This is not easy. We directly load the projects and invoke the the build using the Microsoft.Build.* framework. This alone is still not enough. You have to pin the assemblies you want to use in your .config file:

<结构>   <运行时间> < assemblyBinding的xmlns =瓮:架构 - 微软COM:asm.v1> < dependentAssembly> < assemblyIdentity名=Microsoft.Build.Framework公钥=b03f5f7f11d50a3a文化=中性/> < bindingRedirect oldVersion =0.0.0.0-99.9.9.9NEWVERSION =2.0.0.0/> < / dependentAssembly> < dependentAssembly> < assemblyIdentity名=Microsoft.Build.Engine公钥=b03f5f7f11d50a3a文化=中性/> < bindingRedirect oldVersion =0.0.0.0-99.9.9.9NEWVERSION =2.0.0.0/> < / dependentAssembly> ...等... < / assemblyBinding>   < /运行时间> < /配置>

<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="Microsoft.Build.Framework" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="2.0.0.0"/> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="Microsoft.Build.Engine" publicKeyToken="b03f5f7f11d50a3a" culture="neutral"/> <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="2.0.0.0"/> </dependentAssembly> ... ect ... </assemblyBinding> </runtime> </configuration>

顺便说一句,你也可能有问题,在VS2008新建项目,期待一个名为MSBuildToolsPath必须被定义的属性。您可以如使用的MSBuild在命令行中定义这一点,或使用第二个选项,如果编程指定它:

BTW, you may also have issue with projects newly created in VS2008 expecting a property called "MSBuildToolsPath" which must be defined. You can define this on the command-line if using MSBuild, or specify it programatically if using the second option:

engine.GlobalProperties.SetProperty( "MSBuildToolsPath", msbuildPath );

这篇关于怎样才能有开发商对VS2008目标.NET 2.0(而不是服务包),以避免运行时崩溃?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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