本文整理汇总了C#中Microsoft.Build.Evaluation.GetPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Build.Evaluation.GetPropertyValue方法的具体用法?C# Microsoft.Build.Evaluation.GetPropertyValue怎么用?C# Microsoft.Build.Evaluation.GetPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.Evaluation
的用法示例。
在下文中一共展示了Microsoft.Build.Evaluation.GetPropertyValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DiscoverTests
private void DiscoverTests(Dictionary<string, List<TestFileEntry>> testItems, MSBuild.Project proj, ITestCaseDiscoverySink discoverySink, IMessageLogger logger) {
List<TestFrameworks.NodejsTestInfo> result = new List<TestFrameworks.NodejsTestInfo>();
var projectHome = Path.GetFullPath(Path.Combine(proj.DirectoryPath, "."));
var projSource = ((MSBuild.Project)proj).FullPath;
var nodeExePath =
Nodejs.GetAbsoluteNodeExePath(
projectHome,
proj.GetPropertyValue(NodejsConstants.NodeExePath));
if (!File.Exists(nodeExePath)) {
logger.SendMessage(TestMessageLevel.Error, String.Format("Node.exe was not found. Please install Node.js before running tests."));
return;
}
int testCount = 0;
foreach (string testFx in testItems.Keys) {
TestFrameworks.TestFramework testFramework = GetTestFrameworkObject(testFx);
if (testFramework == null) {
logger.SendMessage(TestMessageLevel.Warning, String.Format("Ignoring unsupported test framework {0}", testFx));
continue;
}
List<TestFileEntry> fileList = testItems[testFx];
string files = string.Join(";", fileList.Select(p=>p.File));
logger.SendMessage(TestMessageLevel.Informational, String.Format("Processing: {0}", files));
List<TestFrameworks.NodejsTestInfo> discoveredTestCases = testFramework.FindTests(fileList.Select(p => p.File), nodeExePath, logger, projectHome);
testCount += discoveredTestCases.Count;
foreach (TestFrameworks.NodejsTestInfo discoveredTest in discoveredTestCases) {
string qualifiedName = discoveredTest.FullyQualifiedName;
logger.SendMessage(TestMessageLevel.Informational, String.Format(" " /*indent*/ + "Creating TestCase:{0}", qualifiedName));
//figure out the test source info such as line number
string filePath = discoveredTest.ModulePath;
TestFileEntry entry = fileList.Find(p => p.File.Equals(filePath, StringComparison.OrdinalIgnoreCase));
FunctionInformation fi = null;
if (entry.IsTypeScriptTest) {
fi = SourceMapper.MaybeMap(new FunctionInformation(String.Empty,
discoveredTest.TestName,
discoveredTest.SourceLine,
entry.File));
}
discoverySink.SendTestCase(
new TestCase(qualifiedName, TestExecutor.ExecutorUri, projSource) {
CodeFilePath = (fi != null) ? fi.Filename : filePath,
LineNumber = (fi != null && fi.LineNumber.HasValue) ? fi.LineNumber.Value : discoveredTest.SourceLine,
DisplayName = discoveredTest.TestName
});
}
logger.SendMessage(TestMessageLevel.Informational, string.Format("Processing finished for framework of {0}", testFx));
}
if (testCount == 0) {
logger.SendMessage(TestMessageLevel.Warning, String.Format("Discovered 0 testcases."));
}
}
示例2: GetTypeScriptBackedJavaScriptFile
internal static string GetTypeScriptBackedJavaScriptFile(MSBuild.Project project, string pathToFile) {
var typeScriptOutDir = project.GetPropertyValue(NodeProjectProperty.TypeScriptOutDir);
return GetTypeScriptBackedJavaScriptFile(project.DirectoryPath, typeScriptOutDir, pathToFile);
}