本文整理汇总了C#中Microsoft.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.GetPropertyValue方法的具体用法?C# Microsoft.GetPropertyValue怎么用?C# Microsoft.GetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.GetPropertyValue方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Find
public int Find(Microsoft.Build.Evaluation.Project prj)
{
int iCount = Items.Count;
int i = 0;
string sGUID = prj.GetPropertyValue("ProjectGuid");
for (i=0;i<iCount;i++)
{
string GuidOfItem = Items[i].Project.GetPropertyValue("ProjectGuid");
if (sGUID.Equals(GuidOfItem))
{
return i;
}
}
return -1;
}
示例2: GetBoolProperty
static bool? GetBoolProperty(Microsoft.Build.Evaluation.Project p, string propertyName)
{
string val = p.GetPropertyValue(propertyName);
if (val.Equals("true", StringComparison.OrdinalIgnoreCase))
return true;
if (val.Equals("false", StringComparison.OrdinalIgnoreCase))
return false;
return null;
}
示例3: SetCompilerSettings
void SetCompilerSettings(Microsoft.Build.Evaluation.Project p)
{
CompilerSettings = new CompilerSettings
{
AllowUnsafeBlocks = GetBoolProperty(p, "AllowUnsafeBlocks") ?? false,
CheckForOverflow = GetBoolProperty(p, "CheckForOverflowUnderflow") ?? false
};
string[] defines = p.GetPropertyValue("DefineConstants")
.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string define in defines)
CompilerSettings.ConditionalSymbols.Add(define);
var config = ConfigurationLoader.Config;
foreach (var define in config.Defines)
CompilerSettings.ConditionalSymbols.Add(define);
}
示例4: GetCommandsDisplayLabel
public static string GetCommandsDisplayLabel(
Microsoft.Build.Evaluation.Project project,
IPythonProject2 projectNode
) {
var label = project.GetPropertyValue("PythonCommandsDisplayLabel") ?? string.Empty;
var match = _customCommandLabelRegex.Match(label);
if (match.Success) {
label = LoadResourceFromAssembly(
match.Groups["assembly"].Value,
match.Groups["namespace"].Value,
match.Groups["key"].Value
);
}
if (string.IsNullOrEmpty(label)) {
return Strings.PythonMenuLabel;
}
return PerformSubstitutions(projectNode, label);
}
示例5: GetCommands
public static IEnumerable<CustomCommand> GetCommands(
Microsoft.Build.Evaluation.Project project,
PythonProjectNode projectNode
) {
var commandNames = project.GetPropertyValue(PythonCommands);
if (!string.IsNullOrEmpty(commandNames)) {
foreach (var name in commandNames.Split(';').Where(n => !string.IsNullOrEmpty(n)).Distinct()) {
ProjectTargetInstance targetInstance;
if (!project.Targets.TryGetValue(name, out targetInstance)) {
continue;
}
var targetXml = (targetInstance.Location.File == project.FullPath) ?
project.Xml :
// TryOpen will only return targets that were already
// loaded in the current collection; otherwise, null.
ProjectRootElement.TryOpen(targetInstance.Location.File, project.ProjectCollection);
if (targetXml == null) {
continue;
}
var target = targetXml.Targets.FirstOrDefault(t => name.Equals(t.Name, StringComparison.OrdinalIgnoreCase));
if (target != null) {
yield return new CustomCommand(projectNode, target.Name, target.Label);
}
}
}
}
示例6: GetBoolProperty
static bool? GetBoolProperty(Microsoft.Build.Evaluation.Project p, string propertyName)
{
string val = p.GetPropertyValue(propertyName);
bool result;
if (bool.TryParse(val, out result))
return result;
else
return null;
}
示例7: GetEvaluatedProperty
public static String GetEvaluatedProperty(Microsoft.Build.Evaluation.Project project, String name)
{
return project.GetPropertyValue(name);
}