本文整理汇总了C#中Microsoft.Build.Evaluation类的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.Build.Evaluation类的具体用法?C# Microsoft.Build.Evaluation怎么用?C# Microsoft.Build.Evaluation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Microsoft.Build.Evaluation类属于命名空间,在下文中一共展示了Microsoft.Build.Evaluation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Children
public static IEnumerable<MBEV.ResolvedImport> Children(this MBEV.ResolvedImport import, MBEV.Project project)
{
return project.Imports.Where(
i => string.Equals(i.ImportingElement.ContainingProject.FullPath,
project.ResolveAllProperties(import.ImportedProject.Location.File),
StringComparison.OrdinalIgnoreCase));
}
示例2: PreProcess
public void PreProcess(MSBuild.Project project)
{
if (project.ProjectFileLocation.File.EndsWith(".user", System.StringComparison.OrdinalIgnoreCase)) {
return;
}
project.SetProperty("ProjectTypeGuids", "{00251F00-BA30-4CE4-96A2-B8A1085F37AA};{3AF33F2E-1136-4D97-BBB7-1795711AC8B8};{9092AA53-FB77-4645-B42D-1CCCA6BD08BD}");
project.SetProperty("VisualStudioVersion", "14.0");
project.Xml.AddProperty("VisualStudioVersion", "14.0").Condition = "'$(VisualStudioVersion)' == ''";
project.Xml.AddProperty("VSToolsPath", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)").Condition = "'$(VSToolsPath)' == ''";
project.Xml.AddImport("$(VSToolsPath)\\Node.js Tools\\Microsoft.NodejsUwp.targets");
project.SetProperty("ProjectHome", ".");
project.SetProperty("ProjectView", "ShowAllFiles");
project.SetProperty("OutputPath", ".");
project.SetProperty("AppContainerApplication", "true");
project.SetProperty("ApplicationType", "Windows Store");
project.SetProperty("OutpApplicationTypeRevisionutPath", "8.2");
project.SetProperty("AppxPackage", "true");
project.SetProperty("WindowsAppContainer", "true");
project.SetProperty("RemoteDebugEnabled", "true");
project.SetProperty("PlatformAware", "true");
project.SetProperty("AvailablePlatforms", "x86,x64,ARM");
// Add package.json
string jsonStr = "{\"name\": \"HelloWorld\",\"version\": \"0.0.0\",\"main\": \"server.js\"}";
string jsonPath = string.Format("{0}\\package.json", project.DirectoryPath);
using (FileStream fs = File.Create(jsonPath)) {
fs.Write(Encoding.ASCII.GetBytes(jsonStr), 0, jsonStr.Length);
}
ProjectItemGroupElement itemGroup = project.Xml.AddItemGroup();
itemGroup.AddItem("Content", jsonPath);
}
示例3: MsBuildProjectElement
/// <summary>
/// Constructor to Wrap an existing MSBuild.ProjectItem
/// Only have internal constructors as the only one who should be creating
/// such object is the project itself (see Project.CreateFileNode()).
/// </summary>
/// <param name="project">Project that owns this item</param>
/// <param name="existingItem">an MSBuild.ProjectItem; can be null if virtualFolder is true</param>
/// <param name="virtualFolder">Is this item virtual (such as reference folder)</param>
internal MsBuildProjectElement(ProjectNode project, MSBuild.ProjectItem existingItem)
: base(project) {
Utilities.ArgumentNotNull("existingItem", existingItem);
// Keep a reference to project and item
_item = existingItem;
}
示例4: PrintPropertyInfo
private static void PrintPropertyInfo(MBEV.ProjectProperty property, int indentCount)
{
var indent = new string('\t', indentCount);
string location;
if (property.IsEnvironmentProperty)
{
location = "(environment)";
}
else if (property.IsReservedProperty)
{
location = "(reserved)";
}
else
{
location = $"{property.Xml.Location.File}:{property.Xml.Location.Line}";
}
Utils.WriteColor($"{indent}Loc: ", ConsoleColor.White);
Utils.WriteLineColor(location, ConsoleColor.DarkCyan);
if (property.UnevaluatedValue == property.EvaluatedValue)
{
Utils.WriteColor($"{indent}Val: ", ConsoleColor.White);
Utils.WriteLineColor(property.EvaluatedValue, ConsoleColor.Green);
}
else
{
Utils.WriteColor($"{indent}Val: ", ConsoleColor.White);
Utils.WriteLineColor(property.UnevaluatedValue, ConsoleColor.DarkGreen);
Utils.WriteColor($"{indent} ", ConsoleColor.White);
Utils.WriteLineColor(property.EvaluatedValue, ConsoleColor.Green);
}
}
示例5: Execute
/// <summary>
/// Executes the task.
/// </summary>
/// <returns>True if the task executed successfully; otherwise, false.</returns>
public bool Execute()
{
var fullPath = SourceProjectPath;
var basePath = Path.GetDirectoryName( fullPath );
var project = ProjectCollection.GlobalProjectCollection.LoadProject( fullPath );
try
{
var assemblyInfos = from item in project.GetItems( "Compile" )
let include = item.EvaluatedInclude
where include.EndsWith( "AssemblyInfo.cs", StringComparison.OrdinalIgnoreCase )
let itemPath = Path.GetFullPath( Path.Combine( basePath, include ) )
let code = File.ReadAllText( itemPath )
select CSharpSyntaxTree.ParseText( code );
var references = new[] { MetadataReference.CreateFromFile( typeof( object ).Assembly.Location ) };
var compilation = CSharpCompilation.Create( project.GetPropertyValue( "AssemblyName" ), assemblyInfos, references );
var attributes = compilation.Assembly.GetAttributes().ToArray();
IsValid = true;
PopulateMetadataFromAttributes( attributes );
}
finally
{
ProjectCollection.GlobalProjectCollection.UnloadProject( project );
}
return IsValid;
}
示例6: Generate
public override void Generate(ProjectType projectType, MSBuild.Project project) {
var filename = Path.Combine(project.DirectoryPath, Name);
File.WriteAllText(filename, Content);
if (!IsExcluded) {
project.AddItem("Content", Name);
}
}
示例7: Trace
public void Trace(MBEV.ResolvedImport import, int traceLevel = 0)
{
PrintImportInfo(import, traceLevel);
foreach (var childImport in import.Children(project))
{
Trace(childImport, traceLevel + $"{import.ImportingElement.Location.Line}: ".Length);
}
}
示例8: Generate
public override void Generate(ProjectType projectType, MSBuild.Project project) {
var target = project.Xml.AddTarget(Name);
if (!string.IsNullOrEmpty(DependsOnTargets)) {
target.DependsOnTargets = DependsOnTargets;
}
foreach (var creator in Creators) {
creator(target);
}
}
示例9: Generate
public override void Generate(ProjectType projectType, MSBuild.Project project) {
if (!IsMissing) {
Directory.CreateDirectory(Path.Combine(project.DirectoryPath, Name));
}
if (!IsExcluded) {
project.AddItem("Folder", Name);
}
}
示例10: Generate
public override void Generate(ProjectType projectType, MSBuild.Project project) {
if (!IsMissing) {
var absName = Path.IsPathRooted(Name) ? Name : Path.Combine(project.DirectoryPath, Name);
var absReferencePath = Path.IsPathRooted(ReferencePath) ? ReferencePath : Path.Combine(project.DirectoryPath, ReferencePath);
NativeMethods.CreateSymbolicLink(absName, absReferencePath);
}
if (!IsExcluded) {
project.AddItem("Folder", Name);
}
}
示例11: PreProcess
public void PreProcess(MSBuild.Project project) {
project.SetProperty("ProjectHome", ".");
project.SetProperty("WorkingDirectory", ".");
project.Xml.AddProperty("VisualStudioVersion", "11.0").Condition = "'$(VisualStudioVersion)' == ''";
project.Xml.AddProperty("PtvsTargetsFile", "$(MSBuildExtensionsPath32)\\Microsoft\\VisualStudio\\v$(VisualStudioVersion)\\Python Tools\\Microsoft.PythonTools.targets");
var import1 = project.Xml.AddImport("$(PtvsTargetsFile)");
import1.Condition = "Exists($(PtvsTargetsFile))";
var import2 = project.Xml.AddImport("$(MSBuildToolsPath)\\Microsoft.Common.targets");
import2.Condition = "!Exists($(PtvsTargetsFile))";
}
示例12: UpdateProject
public void UpdateProject(PythonProjectNode node, MSBuild.Project project) {
lock (_projects) {
if (project == null) {
_projects.Remove(node);
} else if (!_projects.ContainsKey(node) || _projects[node] != project) {
_projects[node] = project;
}
}
// Always raise the event, this also occurs when we're adding projects
// to the MSBuild.Project.
ProjectsChanaged?.Invoke(this, EventArgs.Empty);
}
示例13: Trace
public static void Trace(MBEV.ProjectProperty property, int traceLevel = 0)
{
if (property == null || property.IsGlobalProperty || property.IsReservedProperty)
{
return;
}
PrintPropertyInfo(property, traceLevel);
if (property.IsImported)
{
Trace(property.Predecessor, traceLevel + 1);
}
}
示例14: MSBuildProjectInterpreterFactoryProvider
/// <summary>
/// Creates a new provider for the specified project and service.
/// </summary>
public MSBuildProjectInterpreterFactoryProvider(IInterpreterOptionsService service, MSBuild.Project project) {
if (service == null) {
throw new ArgumentNullException("service");
}
if (project == null) {
throw new ArgumentNullException("project");
}
_rootPaths = new Dictionary<Guid, string>();
_service = service;
_project = project;
// _active starts as null, so we need to start with this event
// hooked up.
_service.DefaultInterpreterChanged += GlobalDefaultInterpreterChanged;
}
示例15: CogaenEditProject
public CogaenEditProject(Package pkg, IOleServiceProvider site, MSBuild.Project buildProject)
{
this.package = pkg;
SetSite(site);
this.BuildProject = buildProject;
this.CanFileNodesHaveChilds = true;
this.OleServiceProvider.AddService(typeof(VSLangProj.VSProject), new OleServiceProvider.ServiceCreatorCallback(this.CreateServices), false);
this.SupportsProjectDesigner = true;
//Store the number of images in ProjectNode so we know the offset of the python icons.
ImageOffset = this.ImageHandler.ImageList.Images.Count;
foreach (Image img in CogaenEditImageList.Images)
{
this.ImageHandler.AddImage(img);
}
InitializeCATIDs();
}