예제 #1
0
 private void AddAotElement()
 {
     Project.AddModelElementsToProject(
         new List <MetadataReference> {
         new MetadataReference(ElementName, AxElementType)
     },
         FolderNode.ID, true);
 }
예제 #2
0
        public void AppendToActiveProject(INamedObject edt)
        {
            VSProjectNode activeProjectNode = GetActiveProjectNode();

            activeProjectNode.AddModelElementsToProject(new List <MetadataReference>
            {
                new MetadataReference(edt.Name, edt.GetType())
            });
        }
예제 #3
0
        /// <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);
        }