void AddConfiguration(string name) { var configuration = new DnxProjectConfiguration(name); Configurations.Add(configuration); EnsureConfigurationHasProjectInstance(configuration); }
/// <summary> /// HACK. The Configuration needs to have the ProjectInstance set otherwise the /// Project's OnDispose method throws a NullReferenceException if a new DNX project /// is created but not when it is loaded from disk. The DNX addin is /// bypassing the normal load and save methods used by the Project class so /// the ProjectInstance is never set. Another problem is the ProjectInstance /// is internal so the DNX addin has to resort to reflection to set this. /// </summary> void EnsureConfigurationHasProjectInstance(DnxProjectConfiguration configuration) { Type type = configuration.GetType(); PropertyInfo property = type.GetProperty("ProjectInstance", BindingFlags.Instance | BindingFlags.NonPublic); if (property != null) { object instance = property.GetValue(configuration); if (instance == null) { property.SetValue(configuration, MSBuildProject.CreateInstance()); } } }
void AddConfiguration(string name) { var configuration = new DnxProjectConfiguration(name); Configurations.Add(configuration); }
void AddConfiguration(string name) { var configuration = new DnxProjectConfiguration (name); Configurations.Add (configuration); }