• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Project类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Project的典型用法代码示例。如果您正苦于以下问题:C# Project类的具体用法?C# Project怎么用?C# Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Project类属于命名空间,在下文中一共展示了Project类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CreateFolders

        public void CreateFolders(Project currentProject, string schedule, string projectName, string relativePath)
        {
            //Create a File under Properties Folder which will contain information about all WebJobs
            //https://github.com/ligershark/webjobsvs/issues/6

            // Check if the WebApp is C# or VB
            string dir = GetProjectDirectory(currentProject);
            var propertiesFolderName = "Properties";
            if (currentProject.CodeModel.Language == CodeModelLanguageConstants.vsCMLanguageVB)
            {
                propertiesFolderName = "My Project";
            }

            DirectoryInfo info = new DirectoryInfo(Path.Combine(dir, propertiesFolderName));

            string readmeFile = Path.Combine(info.FullName, "WebJobs.xml");

            // Copy File if it does not exit
            if (!File.Exists(readmeFile))
                AddReadMe(readmeFile);

            //Add a WebJob info to it
            XDocument doc = XDocument.Load(readmeFile);
            XElement root = new XElement("WebJob");
            root.Add(new XAttribute("Project", projectName));
            root.Add(new XAttribute("RelativePath", relativePath));
            root.Add(new XAttribute("Schedule", schedule));
            doc.Element("WebJobs").Add(root);
            doc.Save(readmeFile);
            currentProject.ProjectItems.AddFromFile(readmeFile);
        }
开发者ID:modulexcite,项目名称:webjobsvs,代码行数:31,代码来源:WebJobCreator.cs


示例2: CompileProject

 public static void CompileProject(Project project)
 {
     if (project != null && !string.IsNullOrEmpty(project.FullName))
     {
         Task.Run(() => Compile(project));
     }
 }
开发者ID:kami-jami,项目名称:WebEssentials2012,代码行数:7,代码来源:LessProjectCompiler.cs


示例3: AddProject

 public void AddProject(Project project)
 {
     if (ProjectAdded != null)
     {
         ProjectAdded(this, new ProjectEventArgs(project));
     }
 }
开发者ID:OsirisTerje,项目名称:sonarlint-vs,代码行数:7,代码来源:MockSolutionManager.cs


示例4: TestUndoRedoCommand

        public void TestUndoRedoCommand()
        {
            // Arrange
            var project = new Project();
            var context = new BlockCommandContext(project);
            ProjectBlockCollection blocks = project.Blocks;
            Block block = blocks[0];
            using (block.AcquireBlockLock(RequestLock.Write))
            {
                block.SetText("abcd");
            }
            int blockVersion = block.Version;
            BlockKey blockKey = block.BlockKey;

            var command = new InsertTextCommand(new BlockPosition(blockKey, 2), "YES");
            project.Commands.Do(command, context);
            project.Commands.Undo(context);

            // Act
            project.Commands.Redo(context);

            // Assert
            Assert.AreEqual(1, blocks.Count);
            Assert.AreEqual(
                new BlockPosition(blocks[0], 5), project.Commands.LastPosition);

            const int index = 0;
            Assert.AreEqual("abYEScd", blocks[index].Text);
            Assert.AreEqual(blockVersion + 3, blocks[index].Version);
        }
开发者ID:dmoonfire,项目名称:author-intrusion-cil,代码行数:30,代码来源:InsertTextBlockCommandTests.cs


示例5: SetGenerateTypeOptions

 public void SetGenerateTypeOptions(
     Accessibility accessibility = Accessibility.NotApplicable,
     TypeKind typeKind = TypeKind.Class,
     string typeName = null,
     Project project = null,
     bool isNewFile = false,
     string newFileName = null,
     IList<string> folders = null,
     string fullFilePath = null,
     Document existingDocument = null,
     bool areFoldersValidIdentifiers = true,
     string defaultNamespace = null,
     bool isCancelled = false)
 {
     Accessibility = accessibility;
     TypeKind = typeKind;
     TypeName = typeName;
     Project = project;
     IsNewFile = isNewFile;
     NewFileName = newFileName;
     Folders = folders;
     FullFilePath = fullFilePath;
     ExistingDocument = existingDocument;
     AreFoldersValidIdentifiers = areFoldersValidIdentifiers;
     DefaultNamespace = defaultNamespace;
     IsCancelled = isCancelled;
 }
开发者ID:Rickinio,项目名称:roslyn,代码行数:27,代码来源:TestGenerateTypeOptionsService.cs


示例6: Main

    public static void Main(string[] args)
    {
        try
        {
            Project project =
                new Project("My Product",

                    new Dir(@"%ProgramFiles%\My Company\My Product",
                        new File(@"AppFiles\MyApp.exe",
                            new FileShortcut("MyApp", @"%Desktop%") { Advertise = true }),
                        new ExeFileShortcut("Uninstall MyApp", "[System64Folder]msiexec.exe", "/x [ProductCode]")),

                    new Dir(@"%ProgramMenu%\My Company\My Product",
                        new ExeFileShortcut("Uninstall MyApp", "[System64Folder]msiexec.exe", "/x [ProductCode]")));

            project.GUID = new Guid("6fe30b47-2577-43ad-9095-1861ba25889b");
            project.UI = WUI.WixUI_ProgressOnly;
            project.OutFileName = "setup";

            Compiler.BuildMsi(project);
        }
        catch (System.Exception ex)
        {
            Console.WriteLine(ex.Message);
        }
    }
开发者ID:Eun,项目名称:WixSharp,代码行数:26,代码来源:setup.cs


示例7: CreateItem

        public async Task<ICallHierarchyMemberItem> CreateItem(ISymbol symbol,
            Project project, IEnumerable<Location> callsites, CancellationToken cancellationToken)
        {
            if (symbol.Kind == SymbolKind.Method ||
                symbol.Kind == SymbolKind.Property ||
                symbol.Kind == SymbolKind.Event ||
                symbol.Kind == SymbolKind.Field)
            {
                symbol = GetTargetSymbol(symbol);

                var finders = await CreateFinders(symbol, project, cancellationToken).ConfigureAwait(false);

                ICallHierarchyMemberItem item = new CallHierarchyItem(symbol,
                    project.Id,
                    finders,
                    () => symbol.GetGlyph().GetImageSource(GlyphService),
                    this,
                    callsites,
                    project.Solution.Workspace);

                return item;
            }

            return null;
        }
开发者ID:CAPCHIK,项目名称:roslyn,代码行数:25,代码来源:CallHierarchyProvider.cs


示例8: ProjectRemoved

 private void ProjectRemoved(Project project)
 {
     if (project.Name == ProjectHelpers.SolutionItemsFolder)
     {
         DeleteSolutionSettings();
     }
 }
开发者ID:hravnx,项目名称:WebEssentials2013,代码行数:7,代码来源:ProjectSettings.cs


示例9: AddStorageContexts

        // Generates all of the Web Forms Pages (Default Insert, Edit, Delete),
        private void AddStorageContexts(
            Project project,
            string selectionRelativePath,
            string dbContextNamespace,
            string dbContextTypeName,
            CodeType modelType,
            bool useMasterPage,
            string masterPage = null,
            bool overwriteViews = true
        )
        {
            if (modelType == null)
            {
                throw new ArgumentNullException("modelType");
            }

            var webForms = new[] { "StorageContext", "StorageContext.KeyHelpers" };

            // Now add each view
            foreach (string webForm in webForms)
            {
                AddStorageContextTemplates(
                    selectionRelativePath: selectionRelativePath,
                    modelType: modelType,
                    dbContextNamespace: dbContextNamespace,
                    dbContextTypeName: dbContextTypeName,
                    webFormsName: webForm,
                    overwrite: overwriteViews);
            }
        }
开发者ID:debbievermaak,项目名称:azure-scaffolder,代码行数:31,代码来源:RazorScaffolder.StorageContext.cs


示例10: Deserialize

        public override object Deserialize(IDictionary<string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            if (dictionary != null)
            {
                var project = new Project();

                project.Id = dictionary.GetValue<int>(RedmineKeys.ID);
                project.Description = dictionary.GetValue<string>(RedmineKeys.DESCRIPTION);
                project.HomePage = dictionary.GetValue<string>(RedmineKeys.HOMEPAGE);
                project.Name = dictionary.GetValue<string>(RedmineKeys.NAME);
                project.Identifier = dictionary.GetValue<string>(RedmineKeys.IDENTIFIER);
                project.Status = dictionary.GetValue<ProjectStatus>(RedmineKeys.STATUS);
                project.CreatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.CREATED_ON);
                project.UpdatedOn = dictionary.GetValue<DateTime?>(RedmineKeys.UPDATED_ON);
                project.Trackers = dictionary.GetValueAsCollection<ProjectTracker>(RedmineKeys.TRACKERS);
                project.CustomFields = dictionary.GetValueAsCollection<IssueCustomField>(RedmineKeys.CUSTOM_FIELDS);
                project.IsPublic = dictionary.GetValue<bool>(RedmineKeys.IS_PUBLIC);
                project.Parent = dictionary.GetValueAsIdentifiableName(RedmineKeys.PARENT);
                project.IssueCategories = dictionary.GetValueAsCollection<ProjectIssueCategory>(RedmineKeys.ISSUE_CATEGORIES);
                project.EnabledModules = dictionary.GetValueAsCollection<ProjectEnabledModule>(RedmineKeys.ENABLED_MODULES);
                return project;
            }

            return null;
        }
开发者ID:Enhakiel,项目名称:redmine-net-api,代码行数:25,代码来源:ProjectConverter.cs


示例11: UpdateForProject

 private void UpdateForProject(Project project)
 {
     if (lastStatuses.ContainsKey(project.Url) && lastCompletedStatuses.ContainsKey(project.Url))
     {
         if (lastStatuses[project.Url].IsInProgress)
         {
             if (project.StatusValue == BuildStatusEnum.Successful)
             {
                 if (BuildStatusUtils.IsErrorBuild(lastCompletedStatuses[project.Url]))
                 {
                     FixedProjects.Add(project);
                 }
                 else
                 {
                     SucceedingProjects.Add(project);
                 }
             }
             else if (TreatAsFailure(project.Status))
             {
                 if (TreatAsFailure(lastCompletedStatuses[project.Url]))
                 {
                     StillFailingProjects.Add(project);
                 }
                 else
                 {
                     FailingProjects.Add(project);
                 }
             }
         }
     }
 }
开发者ID:ViniciusConsultor,项目名称:hudson-tray-tracker,代码行数:31,代码来源:AllServersStatus.cs


示例12: CheckSanity

 public override void CheckSanity(Project project, Whee.WordBuilder.ProjectV2.IProjectSerializer serializer)
 {
     if (_Position == 0)
     {
         serializer.Warn("The capitalize command requires the first argument to be a non-zero integer.", this);
     }
 }
开发者ID:alfar,项目名称:WordBuilder,代码行数:7,代码来源:CapitalizeCommand.cs


示例13: FindNavigableDeclaredSymbolInfosAsync

        private static async Task<ImmutableArray<INavigateToSearchResult>> FindNavigableDeclaredSymbolInfosAsync(
            Project project, Document searchDocument, string pattern, CancellationToken cancellationToken)
        {
            var containsDots = pattern.IndexOf('.') >= 0;
            using (var patternMatcher = new PatternMatcher(pattern, allowFuzzyMatching: true))
            {
                var result = ArrayBuilder<INavigateToSearchResult>.GetInstance();
                foreach (var document in project.Documents)
                {
                    if (searchDocument != null && document != searchDocument)
                    {
                        continue;
                    }

                    cancellationToken.ThrowIfCancellationRequested();
                    var declarationInfo = await document.GetSyntaxTreeIndexAsync(cancellationToken).ConfigureAwait(false);

                    foreach (var declaredSymbolInfo in declarationInfo.DeclaredSymbolInfos)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        var patternMatches = patternMatcher.GetMatches(
                            GetSearchName(declaredSymbolInfo),
                            declaredSymbolInfo.FullyQualifiedContainerName,
                            includeMatchSpans: true);

                        if (!patternMatches.IsEmpty)
                        {
                            result.Add(ConvertResult(containsDots, declaredSymbolInfo, document, patternMatches));
                        }
                    }
                }

                return result.ToImmutableAndFree();
            }
        }
开发者ID:TyOverby,项目名称:roslyn,代码行数:35,代码来源:AbstractNavigateToSearchService.InProcess.cs


示例14: Initialize

		public void Initialize(
			Project project,
			ProjectFolder projectFolder)
		{
			_project = project;
			_projectFolder = projectFolder;
		}
开发者ID:iraychen,项目名称:ZetaResourceEditor,代码行数:7,代码来源:CreateNewFilesForm.cs


示例15: MetadataDbProvider

 /// <summary>
 /// Constructor for the class for Epi 2000 projects
 /// </summary>
 /// <param name="proj">Project the metadata belongs to</param>
 public MetadataDbProvider(Project proj)
 {
     IDbDriverFactory dbFactory = DbDriverFactoryCreator.GetDbDriverFactory(Configuration.AccessDriver);
     OleDbConnectionStringBuilder cnnStrBuilder = new OleDbConnectionStringBuilder();
     cnnStrBuilder.DataSource = proj.FilePath;
     this.db = dbFactory.CreateDatabaseObject(cnnStrBuilder);
 }
开发者ID:NALSS,项目名称:epiinfo-82474,代码行数:11,代码来源:MetadataDbProvider.cs


示例16: Execute

        public static async Task<int> Execute(
            IServiceProvider services, 
            Project project,
            string command,
            string[] args)
        {
            var environment = (IApplicationEnvironment)services.GetService(typeof(IApplicationEnvironment));
            var commandText = project.Commands[command];
            var replacementArgs = CommandGrammar.Process(
                commandText, 
                (key) => GetVariable(environment, key),
                preserveSurroundingQuotes: false)
                .ToArray();

            var entryPoint = replacementArgs[0];
            args = replacementArgs.Skip(1).Concat(args).ToArray();

            if (string.IsNullOrEmpty(entryPoint) ||
                string.Equals(entryPoint, "run", StringComparison.Ordinal))
            {
                entryPoint = project.EntryPoint ?? project.Name;
            }

            CallContextServiceLocator.Locator.ServiceProvider = services;
            return await ExecuteMain(services, entryPoint, args);
        }
开发者ID:israelito3000,项目名称:Testing,代码行数:26,代码来源:ProjectCommand.cs


示例17: CreateProjectSystem

        public static IProjectSystem CreateProjectSystem(Project project)
        {
            if (project == null)
            {
                throw new ArgumentNullException("project");
            }

            if (String.IsNullOrEmpty(project.FullName))
            {
                throw new InvalidOperationException(
                    String.Format(CultureInfo.CurrentCulture,
                    VsResources.DTE_ProjectUnsupported, project.GetName()));
            }

            // Try to get a factory for the project type guid            
            foreach (var guid in project.GetProjectTypeGuids())
            {
                Func<Project, IProjectSystem> factory;
                if (_factories.TryGetValue(guid, out factory))
                {
                    return factory(project);
                }
            }

            // Fall back to the default if we have no special project types
            return new VsProjectSystem(project);
        }
开发者ID:monoman,项目名称:NugetCracker,代码行数:27,代码来源:VsProjectSystemFactory.cs


示例18: ProjectBindingOperation

        public ProjectBindingOperation(IServiceProvider serviceProvider, Project project, ISolutionRuleStore ruleStore)
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }

            if (project == null)
            {
                throw new ArgumentNullException(nameof(project));
            }

            if (ruleStore == null)
            {
                throw new ArgumentNullException(nameof(ruleStore));
            }

            this.serviceProvider = serviceProvider;
            this.initializedProject = project;
            this.ruleStore = ruleStore;

            this.sourceControlledFileSystem = this.serviceProvider.GetService<ISourceControlledFileSystem>();
            this.sourceControlledFileSystem.AssertLocalServiceIsNotNull();

            this.ruleSetSerializer = this.serviceProvider.GetService<IRuleSetSerializer>();
            this.ruleSetSerializer.AssertLocalServiceIsNotNull();
        }
开发者ID:duncanpMS,项目名称:sonarlint-visualstudio,代码行数:27,代码来源:ProjectBindingOperation.cs


示例19: Run

        public static void Run()
        {
            try
            {
                // ExStart:MPPFileUpdate
                // The path to the documents directory.
                string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType.FullName);

                // Read an existing project
                Project project = new Project(dataDir + "MPPFileUpdate.mpp");

                // Create a new task
                Task task = project.RootTask.Children.Add("Task1");

                task.Set(Tsk.Start, new DateTime(2012, 8, 1));
                task.Set(Tsk.Finish, new DateTime(2012, 8, 5));

                // Save the project as MPP project file
                project.Save(dataDir + "AfterLinking_out.Mpp", SaveFileFormat.MPP);
                // ExEnd:MPPFileUpdate   
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message + "\nThis example will only work if you apply a valid Aspose License. You can purchase full license or get 30 day temporary license from http://www.aspose.com/purchase/default.aspx.");
            }            
        }
开发者ID:aspose-tasks,项目名称:Aspose.Tasks-for-.NET,代码行数:26,代码来源:MPPFileUpdate.cs


示例20: SynchronizeWithBuildAsync

        public override async Task SynchronizeWithBuildAsync(Project project, ImmutableArray<DiagnosticData> diagnostics)
        {
            if (!PreferBuildErrors(project.Solution.Workspace))
            {
                // prefer live errors over build errors
                return;
            }

            using (var poolObject = SharedPools.Default<HashSet<string>>().GetPooledObject())
            {
                var lookup = CreateDiagnosticIdLookup(diagnostics);

                foreach (var stateSet in _stateManager.GetStateSets(project))
                {
                    var descriptors = HostAnalyzerManager.GetDiagnosticDescriptors(stateSet.Analyzer);
                    var liveDiagnostics = ConvertToLiveDiagnostics(lookup, descriptors, poolObject.Object);

                    // we are using Default so that things like LB can't use cached information
                    var projectTextVersion = VersionStamp.Default;
                    var semanticVersion = await project.GetDependentSemanticVersionAsync(CancellationToken.None).ConfigureAwait(false);

                    var state = stateSet.GetState(StateType.Project);
                    var existingDiagnostics = await state.TryGetExistingDataAsync(project, CancellationToken.None).ConfigureAwait(false);

                    var mergedDiagnostics = MergeDiagnostics(liveDiagnostics, GetExistingDiagnostics(existingDiagnostics));
                    await state.PersistAsync(project, new AnalysisData(projectTextVersion, semanticVersion, mergedDiagnostics), CancellationToken.None).ConfigureAwait(false);
                    RaiseDiagnosticsUpdated(StateType.Project, project.Id, stateSet, new SolutionArgument(project), mergedDiagnostics);
                }
            }
        }
开发者ID:noahfalk,项目名称:roslyn,代码行数:30,代码来源:DiagnosticIncrementalAnalyzer_BuildSynchronization.cs



注:本文中的Project类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ProjectCreateInformation类代码示例发布时间:2022-05-24
下一篇:
C# ProgressMonitor类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap