private void AddAotElement() { Project.AddModelElementsToProject( new List <MetadataReference> { new MetadataReference(ElementName, AxElementType) }, FolderNode.ID, true); }
public void AppendToActiveProject(INamedObject edt) { VSProjectNode activeProjectNode = GetActiveProjectNode(); activeProjectNode.AddModelElementsToProject(new List <MetadataReference> { new MetadataReference(edt.Name, edt.GetType()) }); }
/// <summary> /// Append createds privilege to active project /// </summary> /// <param name="privilege">Recently created privilege</param> /// <remarks>This method could be improved. Most probably are better ways to achieve this goal.</remarks> protected void appendToProject(AxSecurityPrivilege privilege) { DTE dte = CoreUtility.ServiceProvider.GetService(typeof(DTE)) as DTE; if (dte == null) { throw new NotSupportedException(string.Format(CultureInfo.InvariantCulture, "No service for DTE found. The DTE must be registered as a service for using this API.", new object[0])); } VSProjectNode activeProjectNode = PrivilegeEngine.GetActiveProjectNode(dte); activeProjectNode.AddModelElementsToProject(new List <MetadataReference> { new MetadataReference(privilege.Name, privilege.GetType()) }); //var projectService = ServiceLocator.GetService(typeof(IDynamicsProjectService)) as IDynamicsProjectService; //projectService.AddElementToActiveProject(privilege); }