本文整理汇总了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;
}
示例2: ArtifactPathsCalculator
public ArtifactPathsCalculator(Project project, string compiledArtifactsPath, string packageArtifactsPath, string configuration)
{
_project = project;
CompiledArtifactsPathParameter = compiledArtifactsPath;
PackageArtifactsPathParameter = packageArtifactsPath;
_configuration = configuration;
}
示例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);
};
}
示例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);
}
示例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;
}
示例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);
}
示例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;
}
示例8: RuntimeOutputFiles
public RuntimeOutputFiles(string basePath,
Project project,
string configuration,
NuGetFramework framework,
string runtimeIdentifier) : base(basePath, project, configuration, framework)
{
_runtimeIdentifier = runtimeIdentifier;
}
示例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;
}
示例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);
}
示例11: BuildProjectContexts
protected override IEnumerable<ProjectContext> BuildProjectContexts(Project project)
{
foreach (var framework in project.GetTargetFrameworks())
{
yield return CreateBaseProjectBuilder(project)
.AsDesignTime()
.WithTargetFramework(framework.FrameworkName)
.Build();
}
}
示例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;
}
示例13: BuildProjectCommand
public BuildProjectCommand(
Project project,
string buildBasePath,
string configuration,
string versionSuffix)
{
_project = project;
_buildBasePath = buildBasePath;
_configuration = configuration;
_versionSuffix = versionSuffix;
}
示例14: BuildProjectCommand
public BuildProjectCommand(
Project project,
string buildBasePath,
string configuration,
BuildWorkspace workspace)
{
_project = project;
_buildBasePath = buildBasePath;
_configuration = configuration;
_workspace = workspace;
}
示例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;
}