本文整理汇总了C#中Microsoft.Build.BuildEngine.Project.AddNewUsingTaskFromAssemblyName方法的典型用法代码示例。如果您正苦于以下问题:C# Project.AddNewUsingTaskFromAssemblyName方法的具体用法?C# Project.AddNewUsingTaskFromAssemblyName怎么用?C# Project.AddNewUsingTaskFromAssemblyName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Build.BuildEngine.Project
的用法示例。
在下文中一共展示了Project.AddNewUsingTaskFromAssemblyName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: XnaContentProject
public XnaContentProject(Task task, string msBuildPath, string xnaInstallPath)
{
m_engine = new Engine(msBuildPath);
m_engine.RegisterLogger(new XnaContentLogger(task));
m_project = new Project(m_engine);
m_project.AddNewUsingTaskFromAssemblyName("BuildContent", "Microsoft.Xna.Framework.Content.Pipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d");
m_project.AddNewUsingTaskFromAssemblyName("BuildXact", "Microsoft.Xna.Framework.Content.Pipeline, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6d5c3888ef60e27d");
// Add our Content Pipeline Assemblies
m_pipelineGroup = m_project.AddNewItemGroup();
m_contentGroup = m_project.AddNewItemGroup();
m_contentTarget = m_project.Targets.AddNewTarget("_BuildXNAContentLists");
// Add our Build target
m_xnaTarget = m_project.Targets.AddNewTarget("Build");
m_xnaTarget.DependsOnTargets = "_BuildXNAContentLists";
// Add Default Pipeline Assemblies.
AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll");
AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll");
AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll");
AddPilepineAssembly(xnaInstallPath + "Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll");
}
示例2: GetAssemblyNameScalarThatIsNotSet
public void GetAssemblyNameScalarThatIsNotSet()
{
Project p = new Project(new Engine());
p.AddNewUsingTaskFromAssemblyName("TaskName", @"$(assemblyName)");
object o = p.EvaluatedItems;
Assertion.AssertEquals(@"$(assemblyName)", CompatibilityTestHelpers.FindUsingTaskByName("TaskName", p.UsingTasks).AssemblyName);
}
示例3: GetAssemblyNameSpecialChars
public void GetAssemblyNameSpecialChars()
{
Project p = new Project();
p.AddNewUsingTaskFromAssemblyName("TaskName", @"%*[email protected]$();\");
object o = p.EvaluatedItems;
Assertion.AssertEquals(@"%*[email protected]$();\", CompatibilityTestHelpers.FindUsingTaskByName("TaskName", p.UsingTasks).AssemblyName);
}
示例4: GetAssemblyNameSpecialCharsEscaped
public void GetAssemblyNameSpecialCharsEscaped()
{
Project p = new Project(new Engine());
p.AddNewUsingTaskFromAssemblyName("TaskName", @"%25%2a%3f%40%24%28%29%3b\");
object o = p.EvaluatedItems;
Assertion.AssertEquals(@"%25%2a%3f%40%24%28%29%3b\", CompatibilityTestHelpers.FindUsingTaskByName("TaskName", p.UsingTasks).AssemblyName);
}
示例5: Count_IncrementOnAddName
public void Count_IncrementOnAddName()
{
Project p = new Project(new Engine());
Assertion.AssertEquals(0, p.UsingTasks.Count);
p.AddNewUsingTaskFromAssemblyName("TaskName", "AssemblyName");
Assertion.AssertEquals(0, p.UsingTasks.Count);
object o = p.EvaluatedProperties;
Assertion.AssertEquals(1, p.UsingTasks.Count);
}
示例6: MopUp
public void MopUp(Project project)
{
foreach (var t in tasks.Where(td=>!td.ScriptIsSet))
{
var scr = scripts.FirstOrDefault(s => s.ScriptName.Equals(t.ScriptName));
if (scr == null)
throw new ArgumentNullException("Access to undefined script " + t.ScriptName);
t.SetScript(scr.Script);
}
if (tasks.Count > 0)
project.AddNewUsingTaskFromAssemblyName("RunScript", GetType().Assembly.FullName);
}
示例7: GetAssemblyNameScalarEvaluation
public void GetAssemblyNameScalarEvaluation()
{
string assemblyName = "$(assemblyName)";
Project p = new Project();
p.SetProperty("assemblyName", "aName");
object o = p.EvaluatedItems;
p.AddNewUsingTaskFromAssemblyName("TaskName", assemblyName);
o = p.EvaluatedItems;
Assertion.AssertEquals(assemblyName, CompatibilityTestHelpers.FindUsingTaskByName("TaskName", p.UsingTasks).AssemblyName);
}
示例8: GetTaskNameSpeicalCharsEscaped
public void GetTaskNameSpeicalCharsEscaped()
{
Project p = new Project(new Engine());
p.AddNewUsingTaskFromAssemblyName(@"%25%2a%3f%40%24%28%29%3b\", "assemblyName");
object o = p.EvaluatedItems;
Assertion.AssertNotNull(CompatibilityTestHelpers.FindUsingTaskByName(@"%25%2a%3f%40%24%28%29%3b\", p.UsingTasks));
}
示例9: GetTaskNameSpeicalChars
public void GetTaskNameSpeicalChars()
{
Project p = new Project();
p.AddNewUsingTaskFromAssemblyName(@"%*[email protected]$();\", "assemblyName");
object o = p.EvaluatedItems;
Assertion.AssertNotNull(CompatibilityTestHelpers.FindUsingTaskByName(@"%*[email protected]$();\", p.UsingTasks));
}
示例10: GetTaskNameScalar
public void GetTaskNameScalar()
{
Project p = new Project(new Engine());
p.AddNewUsingTaskFromAssemblyName("$(name)", "assemblyName");
p.SetProperty("name", "TaskName");
object o = p.EvaluatedItems;
Assertion.AssertNotNull(CompatibilityTestHelpers.FindUsingTaskByName("$(name)", p.UsingTasks));
}
示例11: CreateSolutionProject
/// <summary>
/// Given an empty project and a solution, create a new solution project from the solution.
/// </summary>
private static void CreateSolutionProject(SolutionParser solution, Project msbuildProject, BuildEventContext projectBuildEventContext, string wrapperProjectToolsVersion, Engine parentEngine, string solutionProjectCache)
{
// We have to figure out what tools version the children will be built with, because we will
// have to load and scan them to construct the solution wrapper project, and we should use the
// same tools version they'll build with.
string childProjectToolsVersion = DetermineChildProjectToolsVersion(parentEngine, wrapperProjectToolsVersion);
string taskAssembly;
if (String.Equals(msbuildProject.ToolsVersion, "2.0", StringComparison.OrdinalIgnoreCase))
{
taskAssembly = "Microsoft.Build.Tasks, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
}
else
{
taskAssembly = "Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
}
// Fully qualified class names are more performant
msbuildProject.AddNewUsingTaskFromAssemblyName("Microsoft.Build.Tasks.CreateTemporaryVCProject", taskAssembly);
msbuildProject.AddNewUsingTaskFromAssemblyName("Microsoft.Build.Tasks.ResolveVCProjectOutput", taskAssembly);
AddFakeReleaseSolutionConfigurationIfNecessary(solution);
Dictionary<int, List<ProjectInSolution>> projectsByDependencyLevel = new Dictionary<int, List<ProjectInSolution>>();
string fullSolutionConfigurationName = PredictActiveSolutionConfigurationName(solution, parentEngine);
ScanProjectDependencies(solution, parentEngine, childProjectToolsVersion, fullSolutionConfigurationName, projectBuildEventContext);
ConvertVcToVcDependenciesToReferences(solution, parentEngine, projectBuildEventContext);
AssignDependencyLevels(solution, projectsByDependencyLevel);
AddVirtualReferencesForStaticLibraries(solution);
// Add config, platform and tools version to indicate relevance of cache
AddCacheRelatedProperties(msbuildProject, fullSolutionConfigurationName, wrapperProjectToolsVersion, solution.ProjectsInOrder);
// Add default solution configuration/platform names in case the user doesn't specify them on the command line
AddConfigurationPlatformDefaults(msbuildProject, solution);
// Add default Venus configuration names (for more details, see comments for this method)
AddVenusConfigurationDefaults(msbuildProject);
// Add solution related macros
AddGlobalProperties(msbuildProject, solution);
// Add a property group for each solution configuration, each with one XML property containing the
// project configurations in this solution configuration.
foreach (ConfigurationInSolution solutionConfiguration in solution.SolutionConfigurations)
{
AddPropertyGroupForSolutionConfiguration(msbuildProject, solution, solutionConfiguration);
}
// Add the initial target with some solution configuration validation/information
// Only do it if we actually have any solution configurations...
if (solution.SolutionConfigurations.Count > 0)
{
AddInitialTargets(msbuildProject);
}
// Add a <target> element for each project we have
foreach (ProjectInSolution proj in solution.ProjectsInOrder)
{
string errorMessage = null;
// is it a solution folder?
if (proj.ProjectType == SolutionProjectType.SolutionFolder)
{
// Don't add any targets. Solution folder "projects" aren't actually projects at all and should be ignored.
}
else if (proj.ProjectType == SolutionProjectType.WebProject)
{
AddTargetForWebProject(msbuildProject, solution, proj, null);
AddTargetForWebProject(msbuildProject, solution, proj, "Clean");
AddTargetForWebProject(msbuildProject, solution, proj, "Rebuild");
AddTargetForWebProject(msbuildProject, solution, proj, "Publish");
}
else if (proj.ProjectType == SolutionProjectType.VCProject)
{
AddTargetForVCProject(msbuildProject, solution, proj, null);
AddTargetForVCProject(msbuildProject, solution, proj, "Clean");
AddTargetForVCProject(msbuildProject, solution, proj, "Rebuild");
AddTargetForVCProject(msbuildProject, solution, proj, "Publish");
}
// is it an MSBuild project?
else if ((proj.ProjectType == SolutionProjectType.ManagedProject) ||
(proj.CanBeMSBuildProjectFile(out errorMessage)))
{
string safeItemNameFromProjectName = MakeIntoSafeItemName(proj.ProjectName);
string targetOutputItemName = string.Format(CultureInfo.InvariantCulture, "{0}BuildOutput", safeItemNameFromProjectName);
AddTargetForManagedProject(msbuildProject, solution, proj, targetOutputItemName, null);
AddTargetForManagedProject(msbuildProject, solution, proj, null, "Clean");
AddTargetForManagedProject(msbuildProject, solution, proj, targetOutputItemName, "Rebuild");
AddTargetForManagedProject(msbuildProject, solution, proj, null, "Publish");
}
else
{
AddTargetForUnknownProjectType(msbuildProject, solution, proj, null, errorMessage);
//.........这里部分代码省略.........
示例12: TaskComposer
/// <summary>
/// Initializes a new instance of the <see cref="T:TaskComposer"/> class
/// with a logger.
/// </summary>
/// <param name="project">The build project the task should use.</param>
/// <param name="taskType">Type of the task to compose.</param>
/// <param name="buildLogger">The logger to use. Can be null.</param>
public TaskComposer(Project project, Type taskType, IBuildLogger buildLogger)
{
if (project == null)
{
throw new ArgumentNullException("project");
}
this.project = project;
if (taskType == null)
{
throw new ArgumentNullException("taskType");
}
this.taskType = taskType;
this.buildLogger = buildLogger;
project.AddNewUsingTaskFromAssemblyName(this.taskType.FullName, this.taskType.Assembly.FullName);
}
示例13: AddNewUsingTaskFromAssemblyName
public void AddNewUsingTaskFromAssemblyName()
{
Project p = new Project(new Engine());
p.AddNewUsingTaskFromAssemblyName("UsingTaskName", "UsingAssemblyName");
object o = p.EvaluatedItems; // force evaluation of imported projects.
XmlNodeList nl = CompatibilityTestHelpers.GetNodesWithName(p.Xml, "UsingTask");
Assertion.AssertEquals(1, nl.Count);
Assertion.AssertEquals("UsingTaskName", nl[0].Attributes["TaskName"].Value);
Assertion.AssertEquals("UsingAssemblyName", nl[0].Attributes["AssemblyName"].Value);
Assertion.AssertEquals(2, nl[0].Attributes.Count); // no condition;
}