當前位置: 首頁>>代碼示例>>C#>>正文


C# ProjectModel.Project類代碼示例

本文整理匯總了C#中Microsoft.DotNet.ProjectModel.Project的典型用法代碼示例。如果您正苦於以下問題:C# Project類的具體用法?C# Project怎麽用?C# Project使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Project類屬於Microsoft.DotNet.ProjectModel命名空間,在下文中一共展示了Project類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的Microsoft.DotNet.ProjectModel.Project類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。