将Microsoft.Build.BuildEngine.Project迁移到Microsoft.Build.Evaluation.Project

时间:2013-11-15 18:15:08

标签: .net vb.net .net-4.0

我正在尝试迁移我的Microsoft.Build.BuildEngine.Project类以使用Microsoft.Build.Evaluation.Project,原来已经过时了。以前,我使用的是ResetBuildStatus方法,我在新类中找不到相应的方法。

我已经设法转换了大部分内容,但这个仍然在逃避我。

旧代码:

Private _engine As New Microsoft.Build.BuildEngine.Engine
_engine.DefaultToolsVersion = "4.0"
_engine.RegisterLogger(BuildLogger)

Private _buildProject As New Microsoft.Build.BuildEngine.Project(BuildEngine)
If _globalProperties IsNot Nothing Then
     For Each kvp As KeyValuePair(Of String, String) In _globalProperties
         _buildProject.GlobalProperties.SetProperty(kvp.Key, kvp.Value)
     Next kvp
End If
_buildProject.Load(_buildProfile)

新代码:

Private _engine As New Microsoft.Build.Evaluation.ProjectCollection
_engine.DefaultToolsVersion = "4.0"
_engine.RegisterLogger(BuildLogger)

Private _buildProject As New Microsoft.Build.Evaluation.Project(_buildProfile, _globalProperties, "4.0", BuildEngine)
_buildProject.ResetBuildStatus() 'This does not exist

0 个答案:

没有答案