本文整理汇总了C#中MonoDevelop.Projects.MSBuild.MSBuildProject类的典型用法代码示例。如果您正苦于以下问题:C# MSBuildProject类的具体用法?C# MSBuildProject怎么用?C# MSBuildProject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MSBuildProject类属于MonoDevelop.Projects.MSBuild命名空间,在下文中一共展示了MSBuildProject类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: UpdateProject
public void UpdateProject (MSBuildProject msproject)
{
EnsureNuGetPackageBuildImportsTargetUpdater currentUpdater = Updater;
if (currentUpdater != null) {
currentUpdater.UpdateProject (msproject);
}
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:7,代码来源:PackageManagementMSBuildExtension.cs
示例2: MSBuildPropertyEvaluated
internal MSBuildPropertyEvaluated (MSBuildProject project, string name, string value, string evaluatedValue)
{
ParentProject = project;
this.evaluatedValue = evaluatedValue;
this.value = value;
this.name = name;
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:7,代码来源:MSBuildPropertyEvaluated.cs
示例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);
}
}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:33,代码来源:SharedAssetsProjectMSBuildExtension.cs
示例4: UpdateProject
public void UpdateProject (MSBuildProject project)
{
if (String.IsNullOrEmpty (name))
return;
project.AddImportIfMissing (name, location, condition);
}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:7,代码来源:NuGetPackageNewImportsHandler.cs
示例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)));
}
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:59,代码来源:MSBuildEvaluationContext.cs
示例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 ());
}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:MSBuildProjectInstance.cs
示例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;
}
开发者ID:kdubau,项目名称:monodevelop,代码行数:8,代码来源:MSBuildProjectTests.cs
示例8: UpdateRequiresMSBuildSetting
void UpdateRequiresMSBuildSetting (MSBuildProject msproject, bool reloadProjectBuilder = false)
{
if (!RequiresMicrosoftBuild) {
RequiresMicrosoftBuild = msproject.HasNuGetMetadata ();
if (reloadProjectBuilder && RequiresMicrosoftBuild) {
Project.ReloadProjectBuilder ();
EnsureReferencedProjectsRequireMSBuild (reloadProjectBuilder);
}
}
}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:10,代码来源:DotNetProjectPackagingExtension.cs
示例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 ();
}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:10,代码来源:MSBuildProjectExtensions.cs
示例10: OnWriteProject
protected override void OnWriteProject (ProgressMonitor monitor, MSBuildProject msproject)
{
base.OnWriteProject (monitor, msproject);
UpdateRequiresMSBuildSetting (msproject, true);
if (InstallBuildPackagingNuGetAfterWrite) {
InstallBuildPackagingNuGetAfterWrite = false;
Project.InstallBuildPackagingNuGetPackage ();
}
}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:11,代码来源:DotNetProjectPackagingExtension.cs
示例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;
}
}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:12,代码来源:MSBuildEngineV4.cs
示例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;
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:12,代码来源:MSBuildEngineV12.cs
示例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);
}
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:15,代码来源:NuGetPackageForcedImportsRemover.cs
示例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);
}
}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:17,代码来源:PackageManagementMSBuildExtension.cs
示例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");
}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:18,代码来源:NuGetPackageMetadata.cs
示例16: UpdateProject
public void UpdateProject (MSBuildProject project)
{
if (importToRemove == null)
return;
MSBuildTarget nugetImportTarget = FindNuGetImportTarget (project);
if (nugetImportTarget == null)
return;
MSBuildTask msbuildTask = FindErrorTaskForImport (nugetImportTarget, importToRemove);
if (msbuildTask == null)
return;
nugetImportTarget.RemoveTask (msbuildTask);
if (nugetImportTarget.Tasks.Count () == 0) {
project.Remove (nugetImportTarget);
}
}
开发者ID:sushihangover,项目名称:monodevelop,代码行数:19,代码来源:EnsureNuGetPackageBuildImportsTargetUpdater.cs
示例17: OnReadProject
protected override void OnReadProject (ProgressMonitor monitor, MSBuildProject msproject)
{
base.OnReadProject (monitor, msproject);
var import = msproject.Imports.FirstOrDefault (im => im.Label == "Shared");
if (import == null)
return;
// TODO: load the type from msbuild
foreach (var item in msproject.Imports) {
if (item.Project.Equals (CSharptargets, StringComparison.OrdinalIgnoreCase)) {
LanguageName = "C#";
break;
}
if (item.Project.Equals (FSharptargets, StringComparison.OrdinalIgnoreCase)) {
LanguageName = "F#";
break;
}
}
//If for some reason the language name is empty default it to C#
if (String.IsNullOrEmpty(LanguageName))
LanguageName = "C#";
projItemsPath = MSBuildProjectService.FromMSBuildPath (msproject.BaseDirectory, import.Project);
MSBuildProject p = new MSBuildProject (msproject.EngineManager);
p.Load (projItemsPath);
p.Evaluate ();
var cp = p.PropertyGroups.FirstOrDefault (g => g.Label == "Configuration");
if (cp != null)
DefaultNamespace = cp.GetValue ("Import_RootNamespace");
LoadProjectItems (p, ProjectItemFlags.None, usedMSBuildItems);
projitemsProject = p;
}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:37,代码来源:SharedAssetsProject.cs
示例18: OnReadProject
internal protected override void OnReadProject (ProgressMonitor monitor, MSBuildProject msproject)
{
base.OnReadProject (monitor, msproject);
// Convert .projitems imports into project references
foreach (var sp in msproject.Imports.Where (im => im.Label == "Shared" && im.Project.EndsWith (".projitems"))) {
var projitemsFile = sp.Project;
if (!string.IsNullOrEmpty (projitemsFile)) {
projitemsFile = MSBuildProjectService.FromMSBuildPath (Project.ItemDirectory, projitemsFile);
projitemsFile = Path.Combine (Path.GetDirectoryName (msproject.FileName), projitemsFile);
if (File.Exists (projitemsFile)) {
using (MSBuildProject p = new MSBuildProject (msproject.EngineManager)) {
p.Load (projitemsFile);
Project.LoadProjectItems (p, ProjectItemFlags.Hidden | ProjectItemFlags.DontPersist, null);
var r = ProjectReference.CreateProjectReference (projitemsFile);
r.Flags = ProjectItemFlags.DontPersist;
r.SetItemsProjectPath (projitemsFile);
Project.References.Add (r);
}
}
}
}
}
开发者ID:zenek-y,项目名称:monodevelop,代码行数:24,代码来源:SharedAssetsProjectMSBuildExtension.cs
示例19: MigrateProject
static async Task<bool> MigrateProject (ProgressMonitor monitor, SolutionItemExtensionNode st, MSBuildProject p, string fileName, string language)
{
var projectLoadMonitor = GetProjectLoadProgressMonitor (monitor);
if (projectLoadMonitor == null) {
// projectLoadMonitor will be null when running through md-tool, but
// this is not fatal if migration is not required, so just ignore it. --abock
if (!st.IsMigrationRequired)
return false;
LoggingService.LogError (Environment.StackTrace);
monitor.ReportError ("Could not open unmigrated project and no migrator was supplied", null);
throw new UserException ("Project migration failed");
}
var migrationType = st.MigrationHandler.CanPromptForMigration
? await st.MigrationHandler.PromptForMigration (projectLoadMonitor, p, fileName, language)
: projectLoadMonitor.ShouldMigrateProject ();
if (migrationType == MigrationType.Ignore) {
if (st.IsMigrationRequired) {
monitor.ReportError (string.Format ("{1} cannot open the project '{0}' unless it is migrated.", Path.GetFileName (fileName), BrandingService.ApplicationName), null);
throw new UserException ("The user choose not to migrate the project");
} else
return false;
}
var baseDir = (FilePath) Path.GetDirectoryName (fileName);
if (migrationType == MigrationType.BackupAndMigrate) {
var backupDirFirst = baseDir.Combine ("backup");
string backupDir = backupDirFirst;
int i = 0;
while (Directory.Exists (backupDir)) {
backupDir = backupDirFirst + "-" + i.ToString ();
if (i++ > 20) {
throw new Exception ("Too many backup directories");
}
}
Directory.CreateDirectory (backupDir);
foreach (var file in st.MigrationHandler.FilesToBackup (fileName))
File.Copy (file, Path.Combine (backupDir, Path.GetFileName (file)));
}
if (!await st.MigrationHandler.Migrate (projectLoadMonitor, p, fileName, language))
throw new UserException ("Project migration failed");
return true;
}
开发者ID:drasticactions,项目名称:monodevelop,代码行数:46,代码来源:MSBuildProjectService.cs
示例20: MigrateFlavors
internal static async Task MigrateFlavors (ProgressMonitor monitor, string fileName, string typeGuid, MSBuildProject p, List<SolutionItemExtensionNode> nodes)
{
var language = GetLanguageFromGuid (typeGuid);
bool migrated = false;
foreach (var node in nodes) {
if (await MigrateProject (monitor, node, p, fileName, language))
migrated = true;
}
if (migrated)
await p.SaveAsync (fileName);
}
开发者ID:drasticactions,项目名称:monodevelop,代码行数:13,代码来源:MSBuildProjectService.cs
注:本文中的MonoDevelop.Projects.MSBuild.MSBuildProject类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论