Class VSProjectHelper
public static class VSProjectHelper
- Inheritance
-
objectVSProjectHelper
Methods
CompileProjectAssemblyAsync(string, ILogger, string, string, string, Dictionary<string, string>?, BuildRequestDataFlags)
public static ICancellableAsyncBuild? CompileProjectAssemblyAsync(string fullProjectLocation, ILogger logger, string targets = "Build", string configuration = "Debug", string platform = "AnyCPU", Dictionary<string, string>? extraProperties = null, BuildRequestDataFlags flags = BuildRequestDataFlags.None)
Parameters
fullProjectLocationstringloggerILoggertargetsstringconfigurationstringplatformstringextraPropertiesDictionary<string, string>flagsBuildRequestDataFlags
Returns
GenerateRestoreGraphFile(ILogger, string)
public static Task<DependencyGraphSpec> GenerateRestoreGraphFile(ILogger logger, string projectPath)
Parameters
Returns
- Task<DependencyGraphSpec>
GetOrCompileProjectAssembly(string, ILogger, string, bool, string, string, Dictionary<string, string>?, bool, BuildRequestDataFlags)
public static string GetOrCompileProjectAssembly(string fullProjectLocation, ILogger logger, string targets, bool autoCompileProject, string configuration, string platform = "AnyCPU", Dictionary<string, string>? extraProperties = null, bool onlyErrors = false, BuildRequestDataFlags flags = BuildRequestDataFlags.None)
Parameters
fullProjectLocationstringloggerILoggertargetsstringautoCompileProjectboolconfigurationstringplatformstringextraPropertiesDictionary<string, string>onlyErrorsboolflagsBuildRequestDataFlags
Returns
GetPlatformTypeFromProject(Project)
public static PlatformType? GetPlatformTypeFromProject(Project project)
Parameters
projectProject
Returns
GetProjectGuid(Project)
public static Guid GetProjectGuid(Project project)
Parameters
projectProject
Returns
GetProjectPropertyValue(string, string, string?)
Reads a property explicitly declared in the project file (not SDK/import defaults), or null if absent.
Only matches an element carrying the given condition (empty for an unconditioned one),
so a Windows-scoped value isn't confused with a portable-TFM default.
public static string? GetProjectPropertyValue(string fullProjectLocation, string propertyName, string? condition = null)
Parameters
Returns
GetProjectTypeFromProject(Project)
public static ProjectType GetProjectTypeFromProject(Project project)
Parameters
projectProject
Returns
LoadProject(string, string, string, Dictionary<string, string>?)
public static Project LoadProject(string fullProjectLocation, string configuration = "Debug", string platform = "AnyCPU", Dictionary<string, string>? extraProperties = null)
Parameters
fullProjectLocationstringconfigurationstringplatformstringextraPropertiesDictionary<string, string>
Returns
Reset()
public static void Reset()
RestoreNugetPackages(ILogger, string, bool)
public static Task RestoreNugetPackages(ILogger logger, string projectPath, bool tolerateDowngrade = false)
Parameters
loggerILoggerprojectPathstringtolerateDowngradeboolSuppress NU1605 (package downgrade) for this restore — used by the in-place upgrade flow, where the graph is transiently mixed. Off for normal loads so real downgrades fail.
Returns
SetProjectPropertyValue(string, string, string?, string?)
Writes a property (carrying the given condition) to the project file, or removes it
when value is null/empty. Preserves formatting and only saves when something changed.
public static void SetProjectPropertyValue(string fullProjectLocation, string propertyName, string? value, string? condition = null)