本文整理汇总了C#中Microsoft.Build.BuildEngine.BuildPropertyGroup类的典型用法代码示例。如果您正苦于以下问题:C# BuildPropertyGroup类的具体用法?C# BuildPropertyGroup怎么用?C# BuildPropertyGroup使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BuildPropertyGroup类属于Microsoft.Build.BuildEngine命名空间,在下文中一共展示了BuildPropertyGroup类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructWithNothing
public void ConstructWithNothing()
{
BuildPropertyGroup group = new BuildPropertyGroup();
Assertion.AssertEquals(0, group.Count);
Assertion.AssertEquals(false, group.IsImported);
}
示例2: Toolset
public Toolset (string toolsVersion, string toolsPath, string toolsFrameworkPath, BuildPropertyGroup buildProperties)
{
ToolsVersion = toolsVersion;
ToolsPath = toolsPath;
FrameworkToolsPath = toolsFrameworkPath;
BuildProperties = buildProperties;
}
示例3: OnSetupReleaseGroup
protected override void OnSetupReleaseGroup(BuildPropertyGroup group)
{
group.AddNewProperty("DefineDebug", "false");
group.AddNewProperty("DefineTrace", "true");
group.AddNewProperty("DocumentationFile", Name + ".xml");
group.AddNewProperty("NoWarn", "42016,41999,42017,42018,42019,42032,42036,42020,42021,42022");
}
示例4: GetCacheScopeIfExists
private CacheScope GetCacheScopeIfExists(string scopeName, BuildPropertyGroup scopeProperties, string scopeToolsVersion, CacheContentType cacheContentType)
{
CacheScope cacheScope = null;
// Default the version to the default engine version
if (scopeToolsVersion == null)
{
scopeToolsVersion = defaultToolsVersion;
}
// Retrieve list of scopes by this name
if (cacheContents[(int)cacheContentType].ContainsKey(scopeName))
{
List<CacheScope> scopesByName = (List<CacheScope>)cacheContents[(int)cacheContentType][scopeName];
// If the list exists search for matching scope properties otherwise create the list
if (scopesByName != null)
{
lock (cacheManagerLock)
{
for (int i = 0; i < scopesByName.Count; i++)
{
if (scopesByName[i].ScopeProperties.IsEquivalent(scopeProperties) && (String.Compare(scopeToolsVersion, scopesByName[i].ScopeToolsVersion, StringComparison.OrdinalIgnoreCase) == 0))
{
cacheScope = scopesByName[i];
break;
}
}
}
}
}
return cacheScope;
}
示例5: BuildProjectFile
public bool BuildProjectFile (string projectFileName,
string[] targetNames,
IDictionary globalProperties,
IDictionary targetOutputs, string toolsVersion)
{
if (String.IsNullOrEmpty (projectFileName)) {
string oldProjectToolsVersion = project.ToolsVersion;
project.ToolsVersion = toolsVersion;
try {
return engine.BuildProject (project, targetNames, targetOutputs,
BuildSettings.DoNotResetPreviouslyBuiltTargets);
} finally {
project.ToolsVersion = oldProjectToolsVersion;
}
} else {
BuildPropertyGroup bpg = new BuildPropertyGroup ();
if (globalProperties != null)
foreach (DictionaryEntry de in globalProperties)
bpg.AddProperty (new BuildProperty (
(string) de.Key, (string) de.Value,
PropertyType.Global));
return engine.BuildProjectFile (projectFileName,
targetNames, bpg, targetOutputs, BuildSettings.DoNotResetPreviouslyBuiltTargets, toolsVersion);
}
}
示例6: ExpandAllIntoTaskItems3
public void ExpandAllIntoTaskItems3()
{
BuildPropertyGroup pg = new BuildPropertyGroup();
BuildItemGroup ig = new BuildItemGroup();
ig.AddItem(new BuildItem("Compile", "foo.cs"));
ig.AddItem(new BuildItem("Compile", "bar.cs"));
BuildItemGroup ig2 = new BuildItemGroup();
ig2.AddItem(new BuildItem("Resource", "bing.resx"));
Hashtable itemsByType = new Hashtable(StringComparer.OrdinalIgnoreCase);
itemsByType["Compile"] = ig;
itemsByType["Resource"] = ig2;
Expander expander = new Expander(pg, itemsByType);
List<TaskItem> itemsOut = expander.ExpandAllIntoTaskItems("foo;bar;@(compile);@(resource)", null);
ObjectModelHelpers.AssertItemsMatch(@"
foo
bar
foo.cs
bar.cs
bing.resx
", itemsOut.ToArray());
}
示例7: Metadata
public void Metadata()
{
string content = @"
<i Include='i1' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<m>$(p)</m>
<n>n1</n>
</i>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(content);
BuildItem item = CreateBuildItemFromXmlDocument(doc);
Assertion.AssertEquals("i", item.Name);
BuildPropertyGroup properties = new BuildPropertyGroup();
properties.SetProperty("p", "p1");
// Evaluated
Expander expander = new Expander(properties, null, ExpanderOptions.ExpandAll);
item.EvaluateAllItemMetadata(expander, ParserOptions.AllowPropertiesAndItemLists, null, null);
Assertion.AssertEquals("p1", item.GetEvaluatedMetadata("m"));
// Unevaluated
Assertion.AssertEquals("$(p)", item.GetMetadata("m"));
Assertion.AssertEquals("n1", item.GetMetadata("n"));
// All custom metadata
ArrayList metadataNames = new ArrayList(item.CustomMetadataNames);
Assertion.Assert(metadataNames.Contains("n"));
Assertion.Assert(metadataNames.Contains("m"));
// Custom metadata count only
Assertion.AssertEquals(2, item.CustomMetadataCount);
// All metadata count
Assertion.AssertEquals(2 + FileUtilities.ItemSpecModifiers.All.Length, item.MetadataCount);
}
示例8: SetUp
public void SetUp()
{
// Whole bunch of setup code.
XmlElement taskNode = new XmlDocument().CreateElement("MockTask");
LoadedType taskClass = new LoadedType(typeof(MockTask), new AssemblyLoadInfo(typeof(MockTask).Assembly.FullName, null));
Engine engine = new Engine(@"c:\");
loggingHelper = new EngineLoggingServicesHelper();
engine.LoggingServices = loggingHelper;
Project project = new Project(engine);
taskExecutionModule = new MockTaskExecutionModule(new EngineCallback(engine));
// Set up some "fake data" which will be passed to the Task Execution State object
Hashtable[] fakeArray = new Hashtable[1];
fakeArray[0] = new Hashtable();
projectLevelProprtiesForInference = new BuildPropertyGroup();
projectLevelPropertiesForExecution = new BuildPropertyGroup();
inferenceBucketItemsByName = fakeArray;
inferenceBucketMetaData = fakeArray;
projectLevelItemsForInference = new Hashtable();
executionBucketItemsByName = fakeArray;
executionBucketMetaData = fakeArray;
projectLevelItemsForExecution = new Hashtable();
hostObject = null;
projectFileOfTaskNode = "In Memory";
parentProjectFullFileName = project.FullFileName;
nodeProxyId = engine.EngineCallback.CreateTaskContext(project, null, null, taskNode, EngineCallback.inProcNode, new BuildEventContext(BuildEventContext.InvalidNodeId, BuildEventContext.InvalidTargetId, BuildEventContext.InvalidProjectContextId, BuildEventContext.InvalidTaskId));
executionDirectory = Directory.GetCurrentDirectory();
projectId = project.Id;
}
示例9: GetProperties
BuildProperty [] GetProperties (BuildPropertyGroup bpg)
{
List<BuildProperty> list = new List<BuildProperty> ();
foreach (BuildProperty bp in bpg)
list.Add (bp);
return list.ToArray ();
}
示例10: ManualResetEvent
/// <summary>
/// Initialize the node with the id and the callback object
/// </summary>
internal Node
(
int nodeId,
LoggerDescription[] nodeLoggers,
IEngineCallback parentCallback,
BuildPropertyGroup parentGlobalProperties,
ToolsetDefinitionLocations toolsetSearchLocations,
string parentStartupDirectory
)
{
this.nodeId = nodeId;
this.parentCallback = parentCallback;
this.exitNodeEvent = new ManualResetEvent(false);
this.buildRequests = new Queue<BuildRequest>();
this.requestToLocalIdMapping = new Hashtable();
this.lastRequestIdUsed = 0;
this.centralizedLogging = false;
this.nodeLoggers = nodeLoggers;
this.localEngine = null;
this.launchedEngineLoopThread = false;
this.nodeShutdown = false;
this.parentGlobalProperties = parentGlobalProperties;
this.toolsetSearchLocations = toolsetSearchLocations;
this.parentStartupDirectory = parentStartupDirectory;
}
示例11: CantModifyThroughEnumerator
public void CantModifyThroughEnumerator()
{
BuildPropertyGroup pg = new BuildPropertyGroup();
// Only NormalProperties are modifiable anyway
BuildProperty p1 = new BuildProperty("name1", "value1", PropertyType.NormalProperty);
pg.SetProperty(p1);
BuildPropertyGroupProxy proxy = new BuildPropertyGroupProxy(pg);
Hashtable list = new Hashtable(StringComparer.OrdinalIgnoreCase);
// Get the one property
foreach (DictionaryEntry prop in proxy)
{
list.Add(prop.Key, prop.Value);
}
// Change the property
Assertion.Assert((string)list["name1"] == "value1");
list["name1"] = "newValue";
Assertion.Assert((string)list["name1"] == "newValue");
// Get the property again
list = new Hashtable(StringComparer.OrdinalIgnoreCase);
foreach (DictionaryEntry prop in proxy)
{
list.Add(prop.Key, prop.Value);
}
// Property value hasn't changed
Assertion.Assert((string)list["name1"] == "value1");
}
示例12: TestAssignment
public void TestAssignment ()
{
bpg = new BuildPropertyGroup ();
Assert.AreEqual (0, bpg.Count);
Assert.AreEqual (false, bpg.IsImported);
}
示例13: Build
public static bool Build(Project pProj, OutputWindowPane pPane, string pTarget, NameValueCollection pParams)
{
Microsoft.Build.BuildEngine.Engine buildEngine = new Microsoft.Build.BuildEngine.Engine();
BuildExecutor executor = new BuildExecutor(pPane);
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework", false);
if (key == null) {
throw new Exception("Failed to determine .NET Framework install root - no .NETFramework key");
}
string installRoot = key.GetValue("InstallRoot") as string;
if (installRoot == null) {
throw new Exception("Failed to determine .NET Framework install root - no InstallRoot value");
}
key.Close();
buildEngine.BinPath = Path.Combine(installRoot, string.Format("v{0}.{1}.{2}", Environment.Version.Major, Environment.Version.Minor, Environment.Version.Build));
buildEngine.RegisterLogger(executor);
executor.Verbosity = LoggerVerbosity.Normal;
BuildPropertyGroup properties = new BuildPropertyGroup();
foreach (string propKey in pParams.Keys) {
string val = pParams[propKey];
properties.SetProperty(propKey, val, true);
}
return buildEngine.BuildProjectFile(pProj.FileName, new string[]{pTarget}, properties);
}
示例14: SimpleAddAndRetrieveProject
public void SimpleAddAndRetrieveProject()
{
// Initialize engine.
Engine engine = new Engine(@"c:\");
// Instantiate new project manager.
ProjectManager projectManager = new ProjectManager();
// Set up variables that represent the information we would be getting from
// the "MSBuild" task.
string fullPath = @"c:\rajeev\temp\myapp.proj";
BuildPropertyGroup globalProperties = new BuildPropertyGroup();
globalProperties.SetProperty("Configuration", "Debug");
// Create a new project that matches the information that we're pretending
// to receive from the MSBuild task.
Project project1 = new Project(engine);
project1.FullFileName = fullPath;
project1.GlobalProperties = globalProperties;
// Add the new project to the ProjectManager.
projectManager.AddProject(project1);
// Try and retrieve the project from the ProjectManager based on the fullpath + globalprops,
// and make sure we get back the same project we added.
Assertion.AssertEquals(project1, projectManager.GetProject(fullPath, globalProperties, null));
}
示例15: OnSetupDebugGroup
protected override void OnSetupDebugGroup(BuildPropertyGroup group)
{
group.AddNewProperty("Optimize", "false");
group.AddNewProperty("DefineConstants", "DEBUG;TRACE");
group.AddNewProperty("ErrorReport", "prompt");
group.AddNewProperty("WarningLevel", "4");
}