private async Task <string> GetTargetFrameworkStringAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var projectPath = FullName; var platformIdentifier = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetPlatformIdentifier); var platformVersion = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetPlatformVersion); var platformMinVersion = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetPlatformMinVersion); var targetFrameworkMoniker = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetFrameworkMoniker); // Projects supporting TargetFramework and TargetFrameworks are detected before // this check. The values can be passed as null here. var frameworkStrings = MSBuildProjectFrameworkUtility.GetProjectFrameworkStrings( projectFilePath: projectPath, targetFrameworks: null, targetFramework: null, targetFrameworkMoniker: targetFrameworkMoniker, targetPlatformIdentifier: platformIdentifier, targetPlatformVersion: platformVersion, targetPlatformMinVersion: platformMinVersion); return(frameworkStrings.FirstOrDefault()); }
public async Task <IEnumerable <RuntimeDescription> > GetRuntimeIdentifiersAsync() { _threadingService.ThrowIfNotOnUIThread(); var unparsedRuntimeIdentifer = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.RuntimeIdentifier); var unparsedRuntimeIdentifers = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.RuntimeIdentifiers); var runtimes = Enumerable.Empty <string>(); if (unparsedRuntimeIdentifer != null) { runtimes = runtimes.Concat(new[] { unparsedRuntimeIdentifer }); } if (unparsedRuntimeIdentifers != null) { runtimes = runtimes.Concat(unparsedRuntimeIdentifers.Split(';')); } runtimes = runtimes .Select(x => x.Trim()) .Where(x => !string.IsNullOrEmpty(x)); return(runtimes .Select(runtime => new RuntimeDescription(runtime))); }
public async Task <IEnumerable <RuntimeDescription> > GetRuntimeIdentifiersAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var unparsedRuntimeIdentifer = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.RuntimeIdentifier); var unparsedRuntimeIdentifers = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.RuntimeIdentifiers); var runtimes = Enumerable.Empty <string>(); if (unparsedRuntimeIdentifer != null) { runtimes = runtimes.Concat(new[] { unparsedRuntimeIdentifer }); } if (unparsedRuntimeIdentifers != null) { runtimes = runtimes.Concat(unparsedRuntimeIdentifers.Split(';')); } runtimes = runtimes .Select(x => x.Trim()) .Distinct(StringComparer.Ordinal) .Where(x => !string.IsNullOrEmpty(x)); return(runtimes .Select(runtime => new RuntimeDescription(runtime))); }
public async Task <bool> IsRestoreLockedAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var value = await BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.RestoreLockedMode); return(MSBuildStringUtility.IsTrue(value)); }
public async Task <string> GetRestorePackagesWithLockFileAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var value = await BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.RestorePackagesWithLockFile); return(value); }
public Task <string> GetPropertyValueAsync(string propertyName) { if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } return(BuildProperties.GetPropertyValueAsync(propertyName)); }
public async Task <string> GetMSBuildProjectExtensionsPathAsync() { var msbuildProjectExtensionsPath = await BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.MSBuildProjectExtensionsPath); if (string.IsNullOrEmpty(msbuildProjectExtensionsPath)) { return(null); } return(Path.Combine(await GetProjectDirectoryAsync(), msbuildProjectExtensionsPath)); }
public async Task <string> GetPropertyValueAsync(string propertyName) { if (propertyName == null) { throw new ArgumentNullException(nameof(propertyName)); } await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); return(await BuildProperties.GetPropertyValueAsync(propertyName)); }
public async Task <string[]> GetProjectTypeGuidsAsync() { var typeGuid = Project.GetProjectTypeGuids(); var projectTypeGuids = await BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.ProjectTypeGuids); if (!string.IsNullOrEmpty(projectTypeGuids)) { return(MSBuildStringUtility.Split(projectTypeGuids)); } else if (!string.IsNullOrEmpty(typeGuid)) { return(MSBuildStringUtility.Split(typeGuid)); } return(Array.Empty <string>()); }
public async Task <IEnumerable <CompatibilityProfile> > GetRuntimeSupportsAsync() { _threadingService.ThrowIfNotOnUIThread(); var unparsedRuntimeSupports = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.RuntimeSupports); if (unparsedRuntimeSupports == null) { return(Enumerable.Empty <CompatibilityProfile>()); } return(unparsedRuntimeSupports .Split(';') .Select(x => x.Trim()) .Where(x => !string.IsNullOrEmpty(x)) .Select(support => new CompatibilityProfile(support))); }
public async Task <NuGetFramework> GetTargetFrameworkAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var nugetFramework = NuGetFramework.UnsupportedFramework; var projectPath = FullPath; var platformIdentifier = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetPlatformIdentifier); var platformVersion = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetPlatformVersion); var platformMinVersion = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetPlatformMinVersion); var targetFrameworkMoniker = await BuildProperties.GetPropertyValueAsync( ProjectBuildProperties.TargetFrameworkMoniker); // Projects supporting TargetFramework and TargetFrameworks are detected before // this check. The values can be passed as null here. var frameworkStrings = MSBuildProjectFrameworkUtility.GetProjectFrameworkStrings( projectFilePath: projectPath, targetFrameworks: null, targetFramework: null, targetFrameworkMoniker: targetFrameworkMoniker, targetPlatformIdentifier: platformIdentifier, targetPlatformVersion: platformVersion, targetPlatformMinVersion: platformMinVersion); var frameworkString = frameworkStrings.FirstOrDefault(); if (!string.IsNullOrEmpty(frameworkString)) { nugetFramework = NuGetFramework.Parse(frameworkString); } return(nugetFramework); }
public async Task <string[]> GetProjectTypeGuidsAsync() { if (!IsDeferred) { return(VsHierarchyUtility.GetProjectTypeGuids(Project)); } else { // Get ProjectTypeGuids from msbuild property, if it doesn't exist, fall back to projectTypeGuid. var projectTypeGuids = await BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.ProjectTypeGuids); if (!string.IsNullOrEmpty(projectTypeGuids)) { return(MSBuildStringUtility.Split(projectTypeGuids)); } if (!string.IsNullOrEmpty(_projectTypeGuid)) { return(new string[] { _projectTypeGuid }); } return(Array.Empty <string>()); } }
public async Task <string> GetNuGetLockFilePathAsync() { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); return(await BuildProperties.GetPropertyValueAsync(ProjectBuildProperties.NuGetLockFilePath)); }