C# 클래스 MSBuild.Abstractions.MSBuildHelpers

Static helper methods for working with general MSBuildisms.
파일 보기 프로젝트 열기: dotnet/upgrade-assistant 1 사용 예제들

공개 메소드들

메소드 설명
AddImportWindowsDesktopTargets ( ProjectPropertyGroupElement propGroup ) : void

Adds the ImportWindowsDesktopTargets=true property to ensure builds targeting .NET Framework will succeed.

AddUseWPF ( ProjectPropertyGroupElement propGroup ) : void

Adds the UseWPF=true property to the top-level project property group.

AddUseWinForms ( ProjectPropertyGroupElement propGroup ) : void

Adds the UseWindowsForms=True property to the top-level project property group.

AddUseWinUI ( ProjectPropertyGroupElement propGroup ) : void

Adds the UseWinUI=true property to the top-level project property group.

ConditionToDimensionValues ( string condition, ImmutableDictionary &dimensionalValues ) : bool

Tries to parse an MSBuild condition to a dimensional vector only matches standard pattern: '$(DimensionName1)|$(DimensionName2)|...|$(DimensionNameN)'=='DimensionValue1|...|DimensionValueN'.

FrameworkHasAValueTuple ( string tfm ) : bool

Given a TFM string, determines if that TFM has an explicit System.ValueTuple reference.

GetAllProjectTypeGuids ( IProjectRootElement root ) : IEnumerable

Gets a flat list of all project type guids.

GetConfigurationName ( ImmutableDictionary dimensionValues ) : string

Returns a name of a configuration like Debug|AnyCPU.

GetConfigurationName ( string condition ) : string

Returns a name of a configuration like Debug|AnyCPU.

GetOrCreatePackageReferencesItemGroup ( IProjectRootElement rootElement ) : ProjectItemGroupElement

Finds the item group where PackageReferences are specified. Usually there is only one.

GetOrCreateTopLevelPropertyGroup ( BaselineProject baselineProject, IProjectRootElement projectRootElement ) : ProjectPropertyGroupElement

Gets the top-level property group, and if it doesn't exist, creates it.

GetOrCreateTopLevelPropertyGroupWithTFM ( IProjectRootElement rootElement ) : ProjectPropertyGroupElement

Finds the property group with the TFM specified, which is normally the top-level property group.

GetPackagesConfigItem ( ProjectItemGroupElement packagesConfigItemGroup ) : ProjectItemElement

Finds the packages.config item in its containing item group.

GetPackagesConfigItemGroup ( IProjectRootElement root ) : ProjectItemGroupElement?

Finds the item group where a packages.config is included. Assumes only one.

HasProjectTypeGuidsNode ( IProjectRootElement root ) : bool

Checks if a root has a project type guids node.

HasWPFOrWinForms ( ProjectPropertyGroupElement propGroup ) : bool
IsAspNetCore ( IProjectRootElement projectRoot, string tfm ) : bool

Determines if a project should be treated as an ASP.NET Core project (as opposed to classic ASP.NET). Returns true if the project is a web app (since there's no good way to build an ASP.NET app with an SDK-style project except to upgrade to ASP.NET Core) or the project has web dependencies and will target .NET/.NET Core.

IsDesktop ( IProjectRootElement projectRoot ) : bool

Determines if a given project references Desktop assemblies.

IsNETFrameworkMSTestProject ( IProjectRootElement projectRoot ) : bool

Determines if a project is a .NET Framework MSTest project by looking at its references.

IsNotNetFramework ( string tfm ) : bool

Checks if a given TFM is not .NET Framework.

IsTargetFromNuGetPackage ( ProjectImportElement import ) : bool

Checks if an import is a target that comes from the packages directory (which would mean it's probably brought in via a NuGet package).

IsUwp ( IProjectRootElement projectRoot ) : bool

Determines if a given project is UWP.

IsValidMetadataForConversionPurposes ( IProjectMetadata projectMetadata ) : bool

Checks if a metadata item can stay or if it needs to be converted.

IsWPF ( IProjectRootElement projectRoot ) : bool

Determines if a given project is a WPF project by looking at its references.

IsWeb ( IProjectRootElement projectRoot ) : bool

Determines if a given project references ASP.NET assemblies.

IsWebApp ( IProjectRootElement projectRoot ) : bool

Determines if a given project uses ASP.NET web app project type guid.

IsWinForms ( IProjectRootElement projectRoot ) : bool

Determines if a given project is a WinForms project by looking at its references.

IsWindows ( string tfm ) : bool

Checks if a given TFM include -windows.

비공개 메소드들

메소드 설명
DimensionalValuePairsToCondition ( ImmutableDictionary dimensionalValues ) : string

Converts configuration dimensional value vector to a msbuild condition Use the standard format of '$(DimensionName1)|$(DimensionName2)|...|$(DimensionNameN)'=='DimensionValue1|...|DimensionValueN'.

GetPackageReferences ( ProjectItemGroupElement itemGroup ) : IEnumerable

Gets all PackageReference items from a given item group.

GetReferences ( ProjectItemGroupElement itemGroup ) : IEnumerable

Gets all Reference items from a given item group.

메소드 상세

AddImportWindowsDesktopTargets() 공개 정적인 메소드

Adds the ImportWindowsDesktopTargets=true property to ensure builds targeting .NET Framework will succeed.
public static AddImportWindowsDesktopTargets ( ProjectPropertyGroupElement propGroup ) : void
propGroup ProjectPropertyGroupElement
리턴 void

AddUseWPF() 공개 정적인 메소드

Adds the UseWPF=true property to the top-level project property group.
public static AddUseWPF ( ProjectPropertyGroupElement propGroup ) : void
propGroup ProjectPropertyGroupElement
리턴 void

AddUseWinForms() 공개 정적인 메소드

Adds the UseWindowsForms=True property to the top-level project property group.
public static AddUseWinForms ( ProjectPropertyGroupElement propGroup ) : void
propGroup ProjectPropertyGroupElement
리턴 void

AddUseWinUI() 공개 정적인 메소드

Adds the UseWinUI=true property to the top-level project property group.
public static AddUseWinUI ( ProjectPropertyGroupElement propGroup ) : void
propGroup ProjectPropertyGroupElement
리턴 void

ConditionToDimensionValues() 공개 정적인 메소드

Tries to parse an MSBuild condition to a dimensional vector only matches standard pattern: '$(DimensionName1)|$(DimensionName2)|...|$(DimensionNameN)'=='DimensionValue1|...|DimensionValueN'.
public static ConditionToDimensionValues ( string condition, ImmutableDictionary &dimensionalValues ) : bool
condition string msbuild condition string.
dimensionalValues ImmutableDictionary configuration dimensions vector (output).
리턴 bool

FrameworkHasAValueTuple() 공개 정적인 메소드

Given a TFM string, determines if that TFM has an explicit System.ValueTuple reference.
public static FrameworkHasAValueTuple ( string tfm ) : bool
tfm string
리턴 bool

GetAllProjectTypeGuids() 공개 정적인 메소드

Gets a flat list of all project type guids.
public static GetAllProjectTypeGuids ( IProjectRootElement root ) : IEnumerable
root IProjectRootElement
리턴 IEnumerable

GetConfigurationName() 공개 정적인 메소드

Returns a name of a configuration like Debug|AnyCPU.
public static GetConfigurationName ( ImmutableDictionary dimensionValues ) : string
dimensionValues ImmutableDictionary
리턴 string

GetConfigurationName() 공개 정적인 메소드

Returns a name of a configuration like Debug|AnyCPU.
public static GetConfigurationName ( string condition ) : string
condition string
리턴 string

GetOrCreatePackageReferencesItemGroup() 공개 정적인 메소드

Finds the item group where PackageReferences are specified. Usually there is only one.
public static GetOrCreatePackageReferencesItemGroup ( IProjectRootElement rootElement ) : ProjectItemGroupElement
rootElement IProjectRootElement
리턴 ProjectItemGroupElement

GetOrCreateTopLevelPropertyGroup() 공개 정적인 메소드

Gets the top-level property group, and if it doesn't exist, creates it.
public static GetOrCreateTopLevelPropertyGroup ( BaselineProject baselineProject, IProjectRootElement projectRootElement ) : ProjectPropertyGroupElement
baselineProject BaselineProject
projectRootElement IProjectRootElement
리턴 ProjectPropertyGroupElement

GetOrCreateTopLevelPropertyGroupWithTFM() 공개 정적인 메소드

Finds the property group with the TFM specified, which is normally the top-level property group.
public static GetOrCreateTopLevelPropertyGroupWithTFM ( IProjectRootElement rootElement ) : ProjectPropertyGroupElement
rootElement IProjectRootElement
리턴 ProjectPropertyGroupElement

GetPackagesConfigItem() 공개 정적인 메소드

Finds the packages.config item in its containing item group.
public static GetPackagesConfigItem ( ProjectItemGroupElement packagesConfigItemGroup ) : ProjectItemElement
packagesConfigItemGroup ProjectItemGroupElement
리턴 ProjectItemElement

GetPackagesConfigItemGroup() 공개 정적인 메소드

Finds the item group where a packages.config is included. Assumes only one.
public static GetPackagesConfigItemGroup ( IProjectRootElement root ) : ProjectItemGroupElement?
root IProjectRootElement
리턴 ProjectItemGroupElement?

HasProjectTypeGuidsNode() 공개 정적인 메소드

Checks if a root has a project type guids node.
public static HasProjectTypeGuidsNode ( IProjectRootElement root ) : bool
root IProjectRootElement
리턴 bool

HasWPFOrWinForms() 공개 정적인 메소드

public static HasWPFOrWinForms ( ProjectPropertyGroupElement propGroup ) : bool
propGroup ProjectPropertyGroupElement
리턴 bool

IsAspNetCore() 공개 정적인 메소드

Determines if a project should be treated as an ASP.NET Core project (as opposed to classic ASP.NET). Returns true if the project is a web app (since there's no good way to build an ASP.NET app with an SDK-style project except to upgrade to ASP.NET Core) or the project has web dependencies and will target .NET/.NET Core.
public static IsAspNetCore ( IProjectRootElement projectRoot, string tfm ) : bool
projectRoot IProjectRootElement
tfm string
리턴 bool

IsDesktop() 공개 정적인 메소드

Determines if a given project references Desktop assemblies.
public static IsDesktop ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsNETFrameworkMSTestProject() 공개 정적인 메소드

Determines if a project is a .NET Framework MSTest project by looking at its references.
public static IsNETFrameworkMSTestProject ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsNotNetFramework() 공개 정적인 메소드

Checks if a given TFM is not .NET Framework.
public static IsNotNetFramework ( string tfm ) : bool
tfm string
리턴 bool

IsTargetFromNuGetPackage() 공개 정적인 메소드

Checks if an import is a target that comes from the packages directory (which would mean it's probably brought in via a NuGet package).
public static IsTargetFromNuGetPackage ( ProjectImportElement import ) : bool
import ProjectImportElement
리턴 bool

IsUwp() 공개 정적인 메소드

Determines if a given project is UWP.
public static IsUwp ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsValidMetadataForConversionPurposes() 공개 정적인 메소드

Checks if a metadata item can stay or if it needs to be converted.
public static IsValidMetadataForConversionPurposes ( IProjectMetadata projectMetadata ) : bool
projectMetadata IProjectMetadata
리턴 bool

IsWPF() 공개 정적인 메소드

Determines if a given project is a WPF project by looking at its references.
public static IsWPF ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsWeb() 공개 정적인 메소드

Determines if a given project references ASP.NET assemblies.
public static IsWeb ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsWebApp() 공개 정적인 메소드

Determines if a given project uses ASP.NET web app project type guid.
public static IsWebApp ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsWinForms() 공개 정적인 메소드

Determines if a given project is a WinForms project by looking at its references.
public static IsWinForms ( IProjectRootElement projectRoot ) : bool
projectRoot IProjectRootElement
리턴 bool

IsWindows() 공개 정적인 메소드

Checks if a given TFM include -windows.
public static IsWindows ( string tfm ) : bool
tfm string
리턴 bool