本文整理汇总了C#中MonoDevelop.Projects.MSBuild.MSBuildProject类的典型用法代码示例。如果您正苦于以下问题:C# MSBuildProject类的具体用法?C# MSBuildProject怎么用?C# MSBuildProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MSBuildProject类属于MonoDevelop.Projects.MSBuild命名空间,在下文中一共展示了MSBuildProject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateProject
public void UpdateProject (MSBuildProject msproject)
{
EnsureNuGetPackageBuildImportsTargetUpdater currentUpdater = Updater;
if (currentUpdater != null) {
currentUpdater.UpdateProject (msproject);
}
}
示例2: MSBuildPropertyEvaluated
internal MSBuildPropertyEvaluated (MSBuildProject project, string name, string value, string evaluatedValue)
{
ParentProject = project;
this.evaluatedValue = evaluatedValue;
this.value = value;
this.name = name;
}
示例3: OnWriteProject
internal protected override void OnWriteProject (ProgressMonitor monitor, MSBuildProject project)
{
base.OnWriteProject (monitor, project);
HashSet<string> validProjitems = new HashSet<string> ();
foreach (var r in Project.References.Where (rp => rp.ReferenceType == ReferenceType.Project)) {
var ip = r.GetItemsProjectPath ();
if (!string.IsNullOrEmpty (ip)) {
ip = MSBuildProjectService.ToMSBuildPath (Project.ItemDirectory, ip);
validProjitems.Add (ip);
if (!project.Imports.Any (im => im.Project == ip)) {
// If there is already a Shared import, place the new import in the same location
MSBuildObject before = project.Imports.FirstOrDefault (i => i.Label == "Shared" && i.Project.EndsWith (".projitems"));
if (before == null) {
var fsharpProject = project.ProjectTypeGuids.Contains("{F2A71F9B-5D33-465A-A702-920D77279786}");
if (fsharpProject)
//For F# use the first item group as the shared project files have to be listed first
before = project.ItemGroups.FirstOrDefault (i => i.Label != "Shared");
else
before = project.Imports.FirstOrDefault (i => i.Label != "Shared");
}
var im = project.AddNewImport (ip, beforeObject: before);
im.Label = "Shared";
im.Condition = "Exists('" + ip + "')";
}
}
}
foreach (var im in project.Imports.ToArray ()) {
if (im.Label == "Shared" && im.Project.EndsWith (".projitems") && !(validProjitems.Contains (im.Project)))
project.RemoveImport (im.Project);
}
}
示例4: UpdateProject
public void UpdateProject (MSBuildProject project)
{
if (String.IsNullOrEmpty (name))
return;
project.AddImportIfMissing (name, location, condition);
}
示例5: InitEvaluation
internal void InitEvaluation (MSBuildProject project)
{
this.project = project;
// Project file properties
properties.Add ("MSBuildThisFile", Path.GetFileName (project.FileName));
properties.Add ("MSBuildThisFileName", project.FileName.FileNameWithoutExtension);
properties.Add ("MSBuildThisFileExtension", Path.GetExtension (project.FileName));
properties.Add ("MSBuildThisFileFullPath", MSBuildProjectService.ToMSBuildPath (null, project.FileName.FullPath));
string dir = Path.GetDirectoryName (project.FileName) + Path.DirectorySeparatorChar;
properties.Add ("MSBuildThisFileDirectory", MSBuildProjectService.ToMSBuildPath (null, dir));
properties.Add ("MSBuildThisFileDirectoryNoRoot", MSBuildProjectService.ToMSBuildPath (null, dir.Substring (Path.GetPathRoot (dir).Length)));
// Properties only set for the root project, not for imported projects
if (parentContext == null) {
properties.Add ("VisualStudioReferenceAssemblyVersion", project.ToolsVersion + ".0.0");
properties.Add ("MSBuildProjectDefaultTargets", project.DefaultTargets);
properties.Add ("MSBuildProjectExtension", Path.GetExtension (project.FileName));
properties.Add ("MSBuildProjectFile", project.FileName.FileName);
properties.Add ("MSBuildProjectFullPath", MSBuildProjectService.ToMSBuildPath (null, project.FileName.FullPath.ToString()));
properties.Add ("MSBuildProjectName", project.FileName.FileNameWithoutExtension);
dir = project.BaseDirectory.IsNullOrEmpty ? Environment.CurrentDirectory : project.BaseDirectory.ToString();
properties.Add ("MSBuildProjectDirectory", MSBuildProjectService.ToMSBuildPath (null, dir));
properties.Add ("MSBuildProjectDirectoryNoRoot", MSBuildProjectService.ToMSBuildPath (null, dir.Substring (Path.GetPathRoot (dir).Length)));
string toolsVersion = project.ToolsVersion;
if (string.IsNullOrEmpty (toolsVersion) || Version.Parse (toolsVersion) < new Version ("12.0"))
toolsVersion = "12.0";
string toolsPath = ToolLocationHelper.GetPathToBuildTools ("12.0");
var frameworkToolsPath = ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.VersionLatest);
properties.Add ("MSBuildBinPath", MSBuildProjectService.ToMSBuildPath (null, toolsPath));
properties.Add ("MSBuildToolsPath", MSBuildProjectService.ToMSBuildPath (null, toolsPath));
properties.Add ("MSBuildToolsRoot", MSBuildProjectService.ToMSBuildPath (null, Path.GetDirectoryName (toolsPath)));
properties.Add ("MSBuildToolsVersion", toolsVersion);
properties.Add ("OS", Platform.IsWindows ? "Windows_NT" : "Unix");
properties.Add ("MSBuildBinPath32", MSBuildProjectService.ToMSBuildPath (null, toolsPath));
properties.Add ("MSBuildFrameworkToolsPath", MSBuildProjectService.ToMSBuildPath (null, frameworkToolsPath));
properties.Add ("MSBuildFrameworkToolsPath32", MSBuildProjectService.ToMSBuildPath (null, frameworkToolsPath));
if (!String.IsNullOrEmpty (DefaultExtensionsPath)) {
var ep = MSBuildProjectService.ToMSBuildPath (null, extensionsPath);
properties.Add ("MSBuildExtensionsPath", ep);
properties.Add ("MSBuildExtensionsPath32", ep);
properties.Add ("MSBuildExtensionsPath64", ep);
}
// Environment
properties.Add ("MSBuildProgramFiles32", MSBuildProjectService.ToMSBuildPath (null, Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86)));
}
}
示例6: MSBuildProjectInstance
public MSBuildProjectInstance (MSBuildProject project)
{
msproject = project;
evaluatedItemsIgnoringCondition = new List<IMSBuildItemEvaluated> ();
evaluatedProperties = new MSBuildEvaluatedPropertyCollection (msproject);
if (!project.SolutionDirectory.IsNullOrEmpty)
globalProperties.Add ("SolutionDir", project.SolutionDirectory.ToString ());
}
示例7: LoadAndEvaluate
static MSBuildProject LoadAndEvaluate (string dir, string testFile)
{
string projectFile = Util.GetSampleProject (dir, testFile);
var p = new MSBuildProject ();
p.Load (projectFile);
p.Evaluate ();
return p;
}
示例8: UpdateRequiresMSBuildSetting
void UpdateRequiresMSBuildSetting (MSBuildProject msproject, bool reloadProjectBuilder = false)
{
if (!RequiresMicrosoftBuild) {
RequiresMicrosoftBuild = msproject.HasNuGetMetadata ();
if (reloadProjectBuilder && RequiresMicrosoftBuild) {
Project.ReloadProjectBuilder ();
EnsureReferencedProjectsRequireMSBuild (reloadProjectBuilder);
}
}
}
示例9: GetInsertBeforeObject
static MSBuildObject GetInsertBeforeObject (MSBuildProject project, ImportLocation importLocation)
{
if (importLocation == ImportLocation.Top) {
return project.GetAllObjects ().FirstOrDefault ();
}
// Return an unknown MSBuildItem instead of null so the MSBuildProject adds the import as the last
// child in the project.
return new MSBuildItem ();
}
示例10: OnWriteProject
protected override void OnWriteProject (ProgressMonitor monitor, MSBuildProject msproject)
{
base.OnWriteProject (monitor, msproject);
UpdateRequiresMSBuildSetting (msproject, true);
if (InstallBuildPackagingNuGetAfterWrite) {
InstallBuildPackagingNuGetAfterWrite = false;
Project.InstallBuildPackagingNuGetPackage ();
}
}
示例11: LoadProject
public override object LoadProject (MSBuildProject p, string xml, FilePath fileName)
{
lock (engine) {
engine.GlobalProperties.Clear ();
var project = new MSProject (engine);
project.BuildEnabled = false;
project.FullFileName = fileName;
project.LoadXml (xml);
return project;
}
}
示例12: LoadProject
public override object LoadProject (MSBuildProject project, string xml, FilePath fileName)
{
var d = Environment.CurrentDirectory;
Environment.CurrentDirectory = Path.GetDirectoryName (fileName);
try {
var p = projects.LoadProject (new XmlTextReader (new StringReader (xml)));
p.FullPath = fileName;
return p;
} finally {
Environment.CurrentDirectory = d;
}
}
示例13: UpdateProject
public void UpdateProject (MSBuildProject project)
{
string importsRelativeDirectory = MSBuildProjectService.ToMSBuildPath (project.BaseDirectory, importsBaseDirectory);
var importsToRemove = project.Imports.Where (import => IsMatch (import, importsRelativeDirectory)).ToList ();
using (var updater = new EnsureNuGetPackageBuildImportsTargetUpdater ()) {
foreach (MSBuildImport import in importsToRemove) {
project.RemoveImport (import.Project);
updater.RemoveImport (import.Project);
updater.UpdateProject (project);
}
}
}
示例14: UpdateProject
public void UpdateProject (MSBuildProject msproject)
{
NuGetPackageForcedImportsRemover importsRemover = ForcedImportsRemover;
if (importsRemover != null) {
importsRemover.UpdateProject (msproject);
}
EnsureNuGetPackageBuildImportsTargetUpdater currentUpdater = Updater;
if (currentUpdater != null) {
currentUpdater.UpdateProject (msproject);
}
NuGetPackageNewImportsHandler importsHandler = NewImportsHandler;
if (importsHandler != null) {
importsHandler.UpdateProject (msproject);
}
}
示例15: Load
void Load (MSBuildProject project)
{
MSBuildPropertyGroup propertyGroup = project.GetNuGetMetadataPropertyGroup ();
Id = GetProperty (propertyGroup, PackageIdPropertyName);
Version = GetProperty (propertyGroup, "PackageVersion");
Authors = GetProperty (propertyGroup, "Authors");
DevelopmentDependency = GetProperty (propertyGroup, "DevelopmentDependency", false);
IconUrl = GetProperty (propertyGroup, "PackageIconUrl");
Language = GetProperty (propertyGroup, "NeutralLanguage");
LicenseUrl = GetProperty (propertyGroup, "PackageLicenseUrl");
Owners = GetProperty (propertyGroup, "Owners");
ProjectUrl = GetProperty (propertyGroup, "PackageProjectUrl");
ReleaseNotes = GetProperty (propertyGroup, "PackageReleaseNotes");
RequireLicenseAcceptance = GetProperty (propertyGroup, "PackageRequireLicenseAcceptance", false);
Summary = GetProperty (propertyGroup, "Summary");
Tags = GetProperty (propertyGroup, "PackageTags");
Title = GetProperty (propertyGroup, "Title");
}