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

C# ProjectModel.Project类代码示例

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

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



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

示例1: AddNonCultureResources

        private static bool AddNonCultureResources(Project project, List<string> compilerArgs, string intermediateOutputPath)
        {
            var resgenFiles = CompilerUtil.GetNonCultureResources(project, intermediateOutputPath);

            foreach (var resgenFile in resgenFiles)
            {
                if (ResourceUtility.IsResxFile(resgenFile.InputFile))
                {
                    var result =
                        Command.Create("dotnet-resgen",
                            $"\"{resgenFile.InputFile}\" -o \"{resgenFile.OutputFile}\" -v \"{project.Version.Version}\"")
                            .ForwardStdErr()
                            .ForwardStdOut()
                            .Execute();

                    if (result.ExitCode != 0)
                    {
                        return false;
                    }

                    compilerArgs.Add($"--resource:\"{resgenFile.OutputFile}\",{Path.GetFileName(resgenFile.MetadataName)}");
                }
                else
                {
                    compilerArgs.Add($"--resource:\"{resgenFile.InputFile}\",{Path.GetFileName(resgenFile.MetadataName)}");
                }
            }

            return true;
        }
开发者ID:dsyme,项目名称:cli,代码行数:30,代码来源:Program.cs


示例2: ArtifactPathsCalculator

 public ArtifactPathsCalculator(Project project, string compiledArtifactsPath, string packageArtifactsPath, string configuration)
 {
     _project = project;
     CompiledArtifactsPathParameter = compiledArtifactsPath;
     PackageArtifactsPathParameter = packageArtifactsPath;
     _configuration = configuration;
 }
开发者ID:kyulee1,项目名称:cli,代码行数:7,代码来源:ArtifactPathsCalculator.cs


示例3: GetScriptVariable

        private static Func<string, string> GetScriptVariable(Project project, Func<string, string> getVariable)
        {
            var keys = new Dictionary<string, Func<string>>(StringComparer.OrdinalIgnoreCase)
            {
                { "project:Directory", () => project.ProjectDirectory },
                { "project:Name", () => project.Name },
                { "project:Version", () => project.Version.ToString() },
            };

            return key =>
            {
                // try returning key from dictionary
                Func<string> valueFactory;
                if (keys.TryGetValue(key, out valueFactory))
                {
                    return valueFactory();
                }

                // try returning command-specific key
                var value = getVariable(key);
                if (!string.IsNullOrEmpty(value))
                {
                    return value;
                }

                // try returning environment variable
                return Environment.GetEnvironmentVariable(key);
            };
        }
开发者ID:noahfalk,项目名称:cli,代码行数:29,代码来源:ScriptExecutor.cs


示例4: ResolveFromProjectPath

 private static CommandSpec ResolveFromProjectPath(string commandName, IEnumerable<string> args, Project project, string[] inferredExtensionList)
 {
     var commandPath = Env.GetCommandPathFromRootPath(project.ProjectDirectory, commandName, inferredExtensionList);
     return commandPath == null
         ? null
         : CreateCommandSpecPreferringExe(commandName, args, commandPath, CommandResolutionStrategy.ProjectLocal);
 }
开发者ID:ibebbs,项目名称:cli,代码行数:7,代码来源:CommandResolver.cs


示例5: BuildCommand

        public BuildCommand(
            string projectPath,
            string output="",
            string tempOutput="",
            string configuration="",
            bool noHost=false,
            bool native=false,
            string architecture="",
            string ilcArgs="",
            string ilcPath="",
            string appDepSDKPath="",
            bool nativeCppMode=false,
            string cppCompilerFlags="",
            bool buildProfile=true,
            bool forceIncrementalUnsafe=false
            )
            : base("dotnet")
        {
            _projectPath = projectPath;
            _project = ProjectReader.GetProject(projectPath);

            _outputDirectory = output;
            _tempOutputDirectory = tempOutput;
            _configuration = configuration;
            _noHost = noHost;
            _native = native;
            _architecture = architecture;
            _ilcArgs = ilcArgs;
            _ilcPath = ilcPath;
            _appDepSDKPath = appDepSDKPath;
            _nativeCppMode = nativeCppMode;
            _cppCompilerFlags = cppCompilerFlags;
            _buildProfile = buildProfile;
            _forceIncrementalUnsafe = forceIncrementalUnsafe;
        }
开发者ID:robmen,项目名称:dotnetcli,代码行数:35,代码来源:BuildCommand.cs


示例6: TryResolveScriptCommandSpec

 public static CommandSpec TryResolveScriptCommandSpec(string commandName, IEnumerable<string> args, Project project, string[] inferredExtensionList)
 {
     return ResolveFromRootedCommand(commandName, args) ??
            ResolveFromProjectPath(commandName, args, project, inferredExtensionList) ??
            ResolveFromAppBase(commandName, args) ??
            ResolveFromPath(commandName, args);
 }
开发者ID:ibebbs,项目名称:cli,代码行数:7,代码来源:CommandResolver.cs


示例7: AddNonCultureResources

        protected static bool AddNonCultureResources(Project project, List<string> compilerArgs, string intermediateOutputPath)
        {
            var resgenFiles = CompilerUtil.GetNonCultureResources(project, intermediateOutputPath);

            foreach (var resgenFile in resgenFiles)
            {
                if (ResourceUtility.IsResxFile(resgenFile.InputFile))
                {
                    var arguments = new[]
                    {
                        resgenFile.InputFile,
                        $"-o:{resgenFile.OutputFile}",
                        $"-v:{project.Version.Version}"
                    };

                    var rsp = Path.Combine(intermediateOutputPath, $"dotnet-resgen-resx.rsp");
                    File.WriteAllLines(rsp, arguments);

                    var result = Resgen.ResgenCommand.Run(new[] { $"@{rsp}" });

                    if (result != 0)
                    {
                        return false;
                    }

                    compilerArgs.Add($"--resource:\"{resgenFile.OutputFile},{Path.GetFileName(resgenFile.MetadataName)}\"");
                }
                else
                {
                    compilerArgs.Add($"--resource:\"{resgenFile.InputFile},{Path.GetFileName(resgenFile.MetadataName)}\"");
                }
            }

            return true;
        }
开发者ID:ibebbs,项目名称:cli,代码行数:35,代码来源:Compiler.cs


示例8: RuntimeOutputFiles

 public RuntimeOutputFiles(string basePath,
     Project project,
     string configuration,
     NuGetFramework framework,
     string runtimeIdentifier) : base(basePath, project, configuration, framework)
 {
     _runtimeIdentifier = runtimeIdentifier;
 }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:8,代码来源:RuntimeOutputFiles.cs


示例9: ScriptExecutorTests

        public ScriptExecutorTests()
        {
            _root = Temp.CreateDirectory();

            var sourceTestProjectPath = Path.Combine(s_testProjectRoot, "TestApp");
            binTestProjectPath = _root.CopyDirectory(sourceTestProjectPath).Path;
            project = ProjectContext.Create(binTestProjectPath, NuGetFramework.Parse("netstandardapp1.5")).ProjectFile;
        }
开发者ID:ericstj,项目名称:cli,代码行数:8,代码来源:ScriptExecutorTests.cs


示例10: GetCultureResources

        public static List<CultureResgenIO> GetCultureResources(Project project, string outputPath, CommonCompilerOptions compilationOptions)
        {
            if (compilationOptions.EmbedInclude == null)
            {
                return GetCultureResources(project, outputPath);
            }

            return GetCultureResourcesFromIncludeEntries(project, outputPath, compilationOptions);
        }
开发者ID:rodpl,项目名称:Orchard2,代码行数:9,代码来源:CompilerUtility.cs


示例11: BuildProjectContexts

 protected override IEnumerable<ProjectContext> BuildProjectContexts(Project project)
 {
     foreach (var framework in project.GetTargetFrameworks())
     {
         yield return CreateBaseProjectBuilder(project)
             .AsDesignTime()
             .WithTargetFramework(framework.FrameworkName)
             .Build();
     }
 }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:10,代码来源:DesignTimeWorkspace.cs


示例12: PublishCommand

 public PublishCommand(string projectPath, string framework="", string runtime="", string output="", string config="")
     : base("dotnet")
 {
     _path = projectPath;
     _project = ProjectReader.GetProject(projectPath);
     _framework = framework;
     _runtime = runtime;
     _output = output;
     _config = config;
 }
开发者ID:robmen,项目名称:dotnetcli,代码行数:10,代码来源:PublishCommand.cs


示例13: BuildProjectCommand

 public BuildProjectCommand(
     Project project,
     string buildBasePath,
     string configuration,
     string versionSuffix)
 {
     _project = project;
     _buildBasePath = buildBasePath;
     _configuration = configuration;
     _versionSuffix = versionSuffix;
 }
开发者ID:ericstj,项目名称:cli,代码行数:11,代码来源:BuildProjectCommand.cs


示例14: BuildProjectCommand

 public BuildProjectCommand(
     Project project,
     string buildBasePath,
     string configuration,
     BuildWorkspace workspace)
 {
     _project = project;
     _buildBasePath = buildBasePath;
     _configuration = configuration;
     _workspace = workspace;
 }
开发者ID:akrisiun,项目名称:dotnet-cli,代码行数:11,代码来源:BuildProjectCommand.cs


示例15: PublishCommand

 public PublishCommand(string projectPath, string framework = "", string runtime = "", string output = "", string config = "", bool forcePortable = false, bool noBuild = false)
     : base("dotnet")
 {
     _path = projectPath;
     _project = ProjectReader.GetProject(projectPath);
     _framework = framework;
     _runtime = runtime;
     _output = output;
     _config = config;
     _noBuild = noBuild;
 }
开发者ID:krytarowski,项目名称:cli,代码行数:11,代码来源:PublishCommand.cs


示例16: GetNonCultureResources

 // used in incremental compilation
 public static List<NonCultureResgenIO> GetNonCultureResources(Project project, string intermediateOutputPath)
 {
     return 
         (from resourceFile in project.Files.ResourceFiles
             let inputFile = resourceFile.Key
             where string.IsNullOrEmpty(ResourceUtility.GetResourceCultureName(inputFile))
             let metadataName = GetResourceFileMetadataName(project, resourceFile)
             let outputFile = ResourceUtility.IsResxFile(inputFile) ? Path.Combine(intermediateOutputPath, metadataName) : null
             select new NonCultureResgenIO(inputFile, outputFile, metadataName)
             ).ToList();
 }
开发者ID:jinujoseph,项目名称:cli,代码行数:12,代码来源:CompilerUtil.cs


示例17: BuildProjectCommand

 public BuildProjectCommand(
     Project project, 
     ArtifactPathsCalculator artifactPathsCalculator, 
     string intermediateOutputPath, 
     string configuration)
 {
     _project = project;
     _artifactPathsCalculator = artifactPathsCalculator;
     _intermediateOutputPath = intermediateOutputPath;
     _configuration = configuration;
 }
开发者ID:pdelvo,项目名称:cli,代码行数:11,代码来源:BuildProjectCommand.cs


示例18: BuildProjectCommand

 public BuildProjectCommand(
     Project project, 
     ArtifactPathsCalculator artifactPathsCalculator, 
     string buildBasePath, 
     string configuration)
 {
     _project = project;
     _artifactPathsCalculator = artifactPathsCalculator;
     _buildBasePath = buildBasePath;
     _configuration = configuration;
 }
开发者ID:ibebbs,项目名称:cli,代码行数:11,代码来源:BuildProjectCommand.cs


示例19: GetCultureResources

 // used in incremental compilation
 public static List<CultureResgenIO> GetCultureResources(Project project, string outputPath)
 {
     return
         (from resourceFileGroup in project.Files.ResourceFiles.GroupBy(resourceFile => ResourceUtility.GetResourceCultureName(resourceFile.Key))
             let culture = resourceFileGroup.Key
             where !string.IsNullOrEmpty(culture)
             let inputFileToMetadata = resourceFileGroup.ToDictionary(r => r.Key, r => GetResourceFileMetadataName(project, r))
             let resourceOutputPath = Path.Combine(outputPath, culture)
             let outputFile = Path.Combine(resourceOutputPath, project.Name + ".resources.dll")
             select new CultureResgenIO(culture, inputFileToMetadata, outputFile)
             ).ToList();
 }
开发者ID:jinujoseph,项目名称:cli,代码行数:13,代码来源:CompilerUtil.cs


示例20: CreateForScript

        public static Command CreateForScript(string commandName, IEnumerable<string> args, Project project, string[] inferredExtensionList)
        {
            var commandSpec = CommandResolver.TryResolveScriptCommandSpec(commandName, args, project, inferredExtensionList);

            if (commandSpec == null)
            {
                throw new CommandUnknownException(commandName);
            }

            var command = new Command(commandSpec);

            return command;
        }
开发者ID:ibebbs,项目名称:cli,代码行数:13,代码来源:Command.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# ProjectModel.ProjectContext类代码示例发布时间:2022-05-26
下一篇:
C# Framework.BuildTargetContext类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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