/// <summary> /// Adds a dependency to the current package. /// </summary> /// <param name="id">The identifier of the dependency.</param> /// <param name="version">The <see cref="VersionRange" /> of the dependency.</param> /// <param name="targetFramework">The <see cref="NuGetFramework" /> for the dependency.</param> /// <param name="include">An optional <see cref="LibraryIncludeFlags" /> representing the assets to include for the dependency.</param> /// <param name="exclude">An optional <see cref="LibraryIncludeFlags" /> representing the assets to exclude from the dependency.</param> /// <returns>The current <see cref="PackageRepository" />.</returns> public PackageRepository Dependency(string id, VersionRange version, NuGetFramework targetFramework, LibraryIncludeFlags?include = null, LibraryIncludeFlags?exclude = null) { _packageManifest.Metadata.DependencyGroups = _packageManifest.Metadata.DependencyGroups.Concat(new List <PackageDependencyGroup> { new PackageDependencyGroup( targetFramework ?? NuGetFramework.AnyFramework, new List <PackageDependency> { new PackageDependency( id, version, include == null ? null : MSBuildStringUtility.Split(include.ToString(), ','), exclude == null ? null : MSBuildStringUtility.Split(exclude.ToString(), ',')), }), }); _packageManifest.Save(); return(this); }
private IList <PackageSource> GetSources(ISettings settings, bool shouldThrow = true) { ThreadHelper.ThrowIfNotOnUIThread(); var sources = MSBuildStringUtility.Split(_vsProjectAdapter.RestoreSources).AsEnumerable(); if (ShouldReadFromSettings(sources)) { sources = SettingsUtility.GetEnabledSources(settings).Select(e => e.Source); } else { sources = VSRestoreSettingsUtilities.HandleClear(sources); } // Add additional sources sources = sources.Concat(MSBuildStringUtility.Split(_vsProjectAdapter.RestoreAdditionalProjectSources)); return(sources.Select(e => new PackageSource(UriUtility.GetAbsolutePathFromFile(_projectFullPath, e))).ToList()); }
private IList <string> GetFallbackFolders(ISettings settings, bool shouldThrow = true) { ThreadHelper.ThrowIfNotOnUIThread(); var fallbackFolders = MSBuildStringUtility.Split(_vsProjectAdapter.RestoreFallbackFolders).AsEnumerable(); if (ShouldReadFromSettings(fallbackFolders)) { fallbackFolders = SettingsUtility.GetFallbackPackageFolders(settings); } else { fallbackFolders = VSRestoreSettingsUtilities.HandleClear(fallbackFolders); } // Add additional fallback folders fallbackFolders = fallbackFolders.Concat(MSBuildStringUtility.Split(_vsProjectAdapter.RestoreAdditionalProjectFallbackFolders)); return(fallbackFolders.Select(e => UriUtility.GetAbsolutePathFromFile(_projectFullPath, e)).ToList()); }
public static SimpleTestProjectContext CreateProject(string projectName, SimpleTestPathContext pathContext, string projectFrameworks) { var settings = Settings.LoadDefaultSettings(Path.GetDirectoryName(pathContext.NuGetConfig), Path.GetFileName(pathContext.NuGetConfig), null); var project = SimpleTestProjectContext.CreateNETCoreWithSDK( projectName: projectName, solutionRoot: pathContext.SolutionRoot, isToolingVersion15: true, frameworks: MSBuildStringUtility.Split(projectFrameworks)); project.FallbackFolders = (IList <string>)SettingsUtility.GetFallbackPackageFolders(settings); project.GlobalPackagesFolder = SettingsUtility.GetGlobalPackagesFolder(settings); var packageSourceProvider = new PackageSourceProvider(settings); project.Sources = packageSourceProvider.LoadPackageSources(); project.Save(); return(project); }
public async Task VSSolutionRestoreService_VSRestoreSettingsUtilities_Integration(string restoreSources, string restoreAdditionalProjectSources, string expectedRestoreSources, string restoreFallbackFolders, string restoreAdditionalFallbackFolders, string expectedFallbackFolders) { var cps = NewCpsProject(@"{ }"); var pri = cps.Builder .WithTool("Foo.Test", "2.0.0") .WithTargetFrameworkInfo( new VsTargetFrameworkInfo( "netcoreapp2.0", Enumerable.Empty <IVsReferenceItem>(), Enumerable.Empty <IVsReferenceItem>(), new[] { new VsProjectProperty("RestoreSources", restoreSources), new VsProjectProperty("RestoreFallbackFolders", restoreFallbackFolders), new VsProjectProperty("RestoreAdditionalProjectSources", restoreAdditionalProjectSources), new VsProjectProperty("RestoreAdditionalProjectFallbackFolders", restoreAdditionalFallbackFolders) })) .Build(); var projectFullPath = cps.ProjectFullPath; // Act var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri); // Assert SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec); var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath); Assert.NotNull(actualProjectSpec); var specSources = VSRestoreSettingsUtilities.GetSources(NullSettings.Instance, actualProjectSpec).Select(e => e.Source); var expectedSources = MSBuildStringUtility.Split(expectedRestoreSources); Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t))); var specFallback = VSRestoreSettingsUtilities.GetFallbackFolders(NullSettings.Instance, actualProjectSpec); var expectedFallback = MSBuildStringUtility.Split(expectedFallbackFolders); Assert.True( Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t)), "expected: " + string.Join(",", expectedFallback.ToArray()) + "\nactual: " + string.Join(",", specFallback.ToArray())); }
public static PackageReferenceArgs GetPackageReferenceArgs(string packageId, string packageVersion, SimpleTestProjectContext project, string frameworks = "", string packageDirectory = "", string sources = "", bool noRestore = false, bool noVersion = false) { var logger = new TestCommandOutputLogger(); var packageDependency = new PackageDependency(packageId, VersionRange.Parse(packageVersion)); var dgFilePath = string.Empty; if (!noRestore) { dgFilePath = CreateDGFileForProject(project); } return(new PackageReferenceArgs(project.ProjectPath, packageDependency, logger) { Frameworks = MSBuildStringUtility.Split(frameworks), Sources = MSBuildStringUtility.Split(sources), PackageDirectory = packageDirectory, NoRestore = noRestore, NoVersion = noVersion, DgFilePath = dgFilePath }); }
public static SimpleTestPackageContext CreatePackage(string packageId = "packageX", string packageVersion = "1.0.0", string frameworkString = null) { var package = new SimpleTestPackageContext() { Id = packageId, Version = packageVersion }; var frameworks = MSBuildStringUtility.Split(frameworkString); // Make the package Compatible with specific frameworks frameworks? .ToList() .ForEach(f => package.AddFile($"lib/{f}/a.dll")); // To ensure that the nuspec does not have System.Runtime.dll package.Nuspec = GetNetCoreNuspec(packageId, packageVersion); return(package); }
/// <summary> /// Gets the package downloads for the specified project. /// </summary> /// <param name="project">The <see cref="ProjectInstance" /> to get package downloads for.</param> /// <returns>An <see cref="IEnumerable{DownloadDependency}" /> containing the package downloads for the specified project.</returns> internal static IEnumerable <DownloadDependency> GetPackageDownloads(IMSBuildProject project) { // Get the distinct PackageDownload items, ignoring duplicates foreach (var projectItemInstance in project.GetItems("PackageDownload").Distinct(ProjectItemInstanceEvaluatedIncludeComparer.Instance)) { string id = projectItemInstance.Identity; // PackageDownload items can contain multiple versions foreach (var version in MSBuildStringUtility.Split(projectItemInstance.GetProperty("Version"))) { // Validate the version range VersionRange versionRange = !string.IsNullOrWhiteSpace(version) ? VersionRange.Parse(version) : VersionRange.All; if (!(versionRange.HasLowerAndUpperBounds && versionRange.MinVersion.Equals(versionRange.MaxVersion))) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Strings.Error_PackageDownload_OnlyExactVersionsAreAllowed, versionRange.OriginalString)); } yield return(new DownloadDependency(id, versionRange)); } } }
public static SimpleTestProjectContext CreateProject(string projectName, SimpleTestPathContext pathContext, SimpleTestPackageContext package, string projectFrameworks, string packageFramework = null) { var project = SimpleTestProjectContext.CreateNETCoreWithSDK( projectName: projectName, solutionRoot: pathContext.SolutionRoot, frameworks: MSBuildStringUtility.Split(projectFrameworks)); if (packageFramework == null) { project.AddPackageToAllFrameworks(package); } else { project.AddPackageToFramework(packageFramework, package); } project.Save(); return(project); }
static IEnumerable <string> GetOriginalTargetFrameworks(IDotNetProject project) { var properties = project.EvaluatedProperties; if (properties != null) { string targetFramework = properties.GetValue("TargetFramework"); if (targetFramework != null) { return(new [] { targetFramework }); } string targetFrameworks = properties.GetValue("TargetFrameworks"); if (targetFrameworks != null) { return(MSBuildStringUtility.Split(targetFrameworks)); } } var framework = NuGetFramework.Parse(project.TargetFrameworkMoniker.ToString()); return(new [] { framework.GetShortFolderName() }); }
public void GetDistinctNuGetLogCodesOrDefault_DiffLogCodes() { // Arrange var logCodes1 = new List <NuGetLogCode>() { NuGetLogCode.NU1000 }; var logCodes2 = new List <NuGetLogCode>() { NuGetLogCode.NU1001, NuGetLogCode.NU1000 }; var logCodesList = new List <IEnumerable <NuGetLogCode> >() { logCodes1, logCodes2 }; // Act var result = MSBuildStringUtility.GetDistinctNuGetLogCodesOrDefault(logCodesList); // Assert Assert.Equal(0, result.Count()); }
private ITaskItem AssignPropertiesForSingleReference(ITaskItem project, NuGetFramework currentProjectTargetFramework) { var itemWithProperties = new TaskItem(project); var targetFrameworks = project.GetMetadata("TargetFrameworks"); if (string.IsNullOrEmpty(targetFrameworks)) { // No target frameworks set, nothing to do. return(itemWithProperties); } var possibleTargetFrameworks = MSBuildStringUtility.Split(targetFrameworks); var nearestNuGetFramework = NuGetFrameworkUtility.GetNearest(possibleTargetFrameworks, currentProjectTargetFramework, NuGetFramework.Parse); itemWithProperties.SetMetadata("NearestTargetFramework", nearestNuGetFramework ?? FrameworkConstants.SpecialIdentifiers.Unsupported); if (nearestNuGetFramework == null) { Log.LogError(string.Format(Strings.NoCompatibleTargetFramework, project.ItemSpec, CurrentProjectTargetFramework, targetFrameworks)); } return(itemWithProperties); }
private static LibraryDependency ToPackageLibraryDependency(IVsReferenceItem item, bool cpvmEnabled) { if (!TryGetVersionRange(item, "Version", out VersionRange versionRange)) { versionRange = cpvmEnabled ? null : VersionRange.All; } TryGetVersionRange(item, "VersionOverride", out VersionRange versionOverrideRange); var dependency = new LibraryDependency { LibraryRange = new LibraryRange( name: item.Name, versionRange: versionRange, typeConstraint: LibraryDependencyTarget.Package), // Mark packages coming from the SDK as AutoReferenced AutoReferenced = GetPropertyBoolOrFalse(item, "IsImplicitlyDefined"), GeneratePathProperty = GetPropertyBoolOrFalse(item, "GeneratePathProperty"), Aliases = GetPropertyValueOrNull(item, "Aliases"), VersionOverride = versionOverrideRange }; // Add warning suppressions foreach (var code in MSBuildStringUtility.GetNuGetLogCodes(GetPropertyValueOrNull(item, ProjectBuildProperties.NoWarn))) { dependency.NoWarn.Add(code); } MSBuildRestoreUtility.ApplyIncludeFlags( dependency, includeAssets: GetPropertyValueOrNull(item, ProjectBuildProperties.IncludeAssets), excludeAssets: GetPropertyValueOrNull(item, ProjectBuildProperties.ExcludeAssets), privateAssets: GetPropertyValueOrNull(item, ProjectBuildProperties.PrivateAssets)); return(dependency); }
public void GetDistinctNuGetLogCodesOrDefault_SameLogCodes() { // Arrange var logCodes1 = new List <NuGetLogCode>() { NuGetLogCode.NU1000, NuGetLogCode.NU1001 }; var logCodes2 = new List <NuGetLogCode>() { NuGetLogCode.NU1001, NuGetLogCode.NU1000, }; var logCodesList = new List <IEnumerable <NuGetLogCode> >() { logCodes1, logCodes2 }; // Act var result = MSBuildStringUtility.GetDistinctNuGetLogCodesOrDefault(logCodesList); // Assert Assert.Equal(2, result.Count()); Assert.True(result.All(logCodes2.Contains)); }
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 NominateProjectAsync_RestoreSettingsClear(string restorePackagesPath, string restoreSources, string fallbackFolders) { var cps = NewCpsProject("{ }"); var projectFullPath = cps.ProjectFullPath; var pri = cps.Builder .WithTargetFrameworkInfo( new VsTargetFrameworkInfo( "netcoreapp1.0", Enumerable.Empty <IVsReferenceItem>(), Enumerable.Empty <IVsReferenceItem>(), new[] { new VsProjectProperty("RestorePackagesPath", restorePackagesPath), new VsProjectProperty("RestoreSources", restoreSources), new VsProjectProperty("RestoreFallbackFolders", fallbackFolders) })) .Build(); // Act var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, cps.ProjectRestoreInfo); // Assert SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec); var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath); Assert.NotNull(actualProjectSpec); Assert.Equal(restorePackagesPath, actualProjectSpec.RestoreMetadata.PackagesPath); var specSources = actualProjectSpec.RestoreMetadata.Sources?.Select(e => e.Source); var expectedSources = MSBuildStringUtility.Split(restoreSources).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ? new string[] { "Clear" } : MSBuildStringUtility.Split(restoreSources); Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t))); var specFallback = actualProjectSpec.RestoreMetadata.FallbackFolders; var expectedFallback = MSBuildStringUtility.Split(fallbackFolders).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ? new string[] { "Clear" } : MSBuildStringUtility.Split(fallbackFolders); Assert.True(Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t))); }
// The targetpaths returned from this function contain the directory in the nuget package where the file would go to. The filename is added later on to the target path. // whether or not the filename is added later on is dependent upon the fact that does the targetpath resolved here ends with a directory separator char or not. private IEnumerable <ContentMetadata> GetContentMetadata(IMSBuildItem packageFile, string sourcePath, PackArgs packArgs, string[] contentTargetFolders) { var targetPaths = contentTargetFolders .Select(PathUtility.EnsureTrailingSlash) .ToList(); var isPackagePathSpecified = packageFile.Properties.Contains("PackagePath"); // if user specified a PackagePath, then use that. Look for any ** which are indicated by the RecrusiveDir metadata in msbuild. if (isPackagePathSpecified) { // The rule here is that if the PackagePath is an empty string, then we add the file to the root of the package. // Instead if it is a ';' delimited string, then the user needs to specify a '\' to indicate that the file should go to the root of the package. var packagePathString = packageFile.GetProperty("PackagePath"); targetPaths = packagePathString == null ? new string[] { string.Empty }.ToList() : MSBuildStringUtility.Split(packagePathString) .Distinct() .ToList(); var recursiveDir = packageFile.GetProperty("RecursiveDir"); // The below NuGetRecursiveDir workaround needs to be done due to msbuild bug https://github.com/Microsoft/msbuild/issues/3121 recursiveDir = string.IsNullOrEmpty(recursiveDir) ? packageFile.GetProperty("NuGetRecursiveDir") : recursiveDir; if (!string.IsNullOrEmpty(recursiveDir)) { var newTargetPaths = new List <string>(); var fileName = Path.GetFileName(sourcePath); foreach (var targetPath in targetPaths) { newTargetPaths.Add(PathUtility.GetStringComparerBasedOnOS(). Compare(Path.GetExtension(fileName), Path.GetExtension(targetPath)) == 0 && !string.IsNullOrEmpty(Path.GetExtension(fileName)) ? targetPath : Path.Combine(targetPath, recursiveDir)); } targetPaths = newTargetPaths; } } var buildActionString = packageFile.GetProperty("BuildAction"); var buildAction = BuildAction.Parse(string.IsNullOrEmpty(buildActionString) ? "None" : buildActionString); // TODO: Do the work to get the right language of the project, tracked via https://github.com/NuGet/Home/issues/4100 var language = buildAction.Equals(BuildAction.Compile) ? "cs" : "any"; var setOfTargetPaths = new HashSet <string>(targetPaths, PathUtility.GetStringComparerBasedOnOS()); // If package path wasn't specified, then we expand the "contentFiles" value we // got from ContentTargetFolders and expand it to contentFiles/any/<TFM>/ if (!isPackagePathSpecified) { if (setOfTargetPaths.Remove("contentFiles" + Path.DirectorySeparatorChar) || setOfTargetPaths.Remove("contentFiles")) { foreach (var framework in packArgs.PackTargetArgs.TargetFrameworks) { setOfTargetPaths.Add(PathUtility.EnsureTrailingSlash( Path.Combine("contentFiles", language, framework.GetShortFolderName() ))); } } } // this if condition means there is no package path provided, file is within the project directory // and the target path should preserve this relative directory structure. // This case would be something like : // <Content Include= "folderA\folderB\abc.txt"> // Since the package path wasn't specified, we will add this to the package paths obtained via ContentTargetFolders and preserve // relative directory structure if (!isPackagePathSpecified && sourcePath.StartsWith(packArgs.CurrentDirectory, StringComparison.CurrentCultureIgnoreCase) && !Path.GetFileName(sourcePath) .Equals(packageFile.GetProperty(IdentityProperty), StringComparison.CurrentCultureIgnoreCase)) { var newTargetPaths = new List <string>(); var identity = packageFile.GetProperty(IdentityProperty); // Identity can be a rooted absolute path too, in which case find the path relative to the current directory if (Path.IsPathRooted(identity)) { identity = PathUtility.GetRelativePath(PathUtility.EnsureTrailingSlash(packArgs.CurrentDirectory), identity); identity = Path.GetDirectoryName(identity); } // If identity is not a rooted path, then it is a relative path to the project directory else if (identity.EndsWith(Path.GetFileName(sourcePath), StringComparison.CurrentCultureIgnoreCase)) { identity = Path.GetDirectoryName(identity); } foreach (var targetPath in setOfTargetPaths) { var newTargetPath = Path.Combine(targetPath, identity); // We need to do this because evaluated identity in the above line of code can be an empty string // in the case when the original identity string was the absolute path to a file in project directory, and is in // the same directory as the csproj file. newTargetPath = PathUtility.EnsureTrailingSlash(newTargetPath); newTargetPaths.Add(newTargetPath); } setOfTargetPaths = new HashSet <string>(newTargetPaths, PathUtility.GetStringComparerBasedOnOS()); } // we take the final set of evaluated target paths and append the file name to it if not // already done. we check whether the extension of the target path is the same as the extension // of the source path and add the filename accordingly. var totalSetOfTargetPaths = new List <string>(); foreach (var targetPath in setOfTargetPaths) { var currentPath = targetPath; var fileName = Path.GetFileName(sourcePath); if (string.IsNullOrEmpty(Path.GetExtension(fileName)) || !Path.GetExtension(fileName) .Equals(Path.GetExtension(targetPath), StringComparison.OrdinalIgnoreCase)) { currentPath = Path.Combine(targetPath, fileName); } totalSetOfTargetPaths.Add(currentPath); } return(totalSetOfTargetPaths.Select(target => new ContentMetadata() { BuildAction = buildAction.Value, Source = sourcePath, Target = target, CopyToOutput = packageFile.GetProperty("PackageCopyToOutput"), Flatten = packageFile.GetProperty("PackageFlatten") })); }
internal static WarningProperties GetProjectWideWarningProperties(IEnumerable targetFrameworks) { return(WarningProperties.GetWarningProperties( treatWarningsAsErrors: GetSingleOrDefaultPropertyValue(targetFrameworks, ProjectBuildProperties.TreatWarningsAsErrors, e => e), warningsAsErrors: GetSingleOrDefaultNuGetLogCodes(targetFrameworks, ProjectBuildProperties.WarningsAsErrors, e => MSBuildStringUtility.GetNuGetLogCodes(e)), noWarn: GetSingleOrDefaultNuGetLogCodes(targetFrameworks, ProjectBuildProperties.NoWarn, e => MSBuildStringUtility.GetNuGetLogCodes(e)))); }
public async Task GetPackageSpecsAsync_ReadSettingsWithFullPaths(string restorePackagesPath, string sources, string fallbackFolders) { // Arrange using (var testDirectory = TestDirectory.Create()) { var projectAdapter = CreateProjectAdapter(testDirectory); Mock.Get(projectAdapter) .SetupGet(x => x.RestorePackagesPath) .Returns(restorePackagesPath); Mock.Get(projectAdapter) .SetupGet(x => x.RestoreSources) .Returns(sources); Mock.Get(projectAdapter) .SetupGet(x => x.RestoreFallbackFolders) .Returns(fallbackFolders); var projectServices = new TestProjectSystemServices(); var testProject = new LegacyPackageReferenceProject( projectAdapter, Guid.NewGuid().ToString(), projectServices, _threadingService); var settings = NullSettings.Instance; var testDependencyGraphCacheContext = new DependencyGraphCacheContext(NullLogger.Instance, settings); await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); // Act var packageSpecs = await testProject.GetPackageSpecsAsync(testDependencyGraphCacheContext); // Assert Assert.NotNull(packageSpecs); var actualRestoreSpec = packageSpecs.Single(); SpecValidationUtility.ValidateProjectSpec(actualRestoreSpec); // Assert packagespath Assert.Equal(restorePackagesPath != null ? restorePackagesPath : SettingsUtility.GetGlobalPackagesFolder(settings), actualRestoreSpec.RestoreMetadata.PackagesPath); // assert sources var specSources = actualRestoreSpec.RestoreMetadata.Sources.Select(e => e.Source); var expectedSources = sources != null?MSBuildStringUtility.Split(sources) : SettingsUtility.GetEnabledSources(settings).Select(e => e.Source); Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t))); // assert fallbackfolders var specFallback = actualRestoreSpec.RestoreMetadata.FallbackFolders; var expectedFolders = fallbackFolders != null?MSBuildStringUtility.Split(fallbackFolders) : SettingsUtility.GetFallbackPackageFolders(settings); Assert.True(Enumerable.SequenceEqual(expectedFolders.OrderBy(t => t), specFallback.OrderBy(t => t))); // Verify Mock.Get(projectAdapter) .Verify(x => x.RestorePackagesPath, Times.Once); Mock.Get(projectAdapter) .Verify(x => x.RestoreSources, Times.Once); Mock.Get(projectAdapter) .Verify(x => x.RestoreFallbackFolders, Times.Once); } }
/// <summary> /// Gets the restore metadata and target framework information for the specified project. /// </summary> /// <param name="project">An <see cref="IMSBuildProject" /> representing the project.</param> /// <param name="projectsByTargetFramework">A <see cref="IReadOnlyDictionary{NuGetFramework,IMSBuildProject}" /> containing the inner nodes by target framework.</param> /// <param name="settings">The <see cref="ISettings" /> of the specified project.</param> /// <returns>A <see cref="Tuple" /> containing the <see cref="ProjectRestoreMetadata" /> and <see cref="List{TargetFrameworkInformation}" /> for the specified project.</returns> private (ProjectRestoreMetadata RestoreMetadata, List <TargetFrameworkInformation> TargetFrameworkInfos) GetProjectRestoreMetadataAndTargetFrameworkInformation(IMSBuildProject project, IReadOnlyDictionary <NuGetFramework, IMSBuildProject> projectsByTargetFramework, ISettings settings) { var projectName = GetProjectName(project); var outputPath = GetRestoreOutputPath(project); var targetFrameworkInfos = GetTargetFrameworkInfos(projectsByTargetFramework); var projectStyleResult = BuildTasksUtility.GetProjectRestoreStyle( restoreProjectStyle: project.GetProperty("RestoreProjectStyle"), hasPackageReferenceItems: targetFrameworkInfos.Any(i => i.Dependencies.Any()), projectJsonPath: project.GetProperty("_CurrentProjectJsonPath"), projectDirectory: project.Directory, projectName: project.GetProperty("MSBuildProjectName"), log: MSBuildLogger); var projectStyle = projectStyleResult.ProjectStyle; var innerNodes = projectsByTargetFramework.Values.ToList(); ProjectRestoreMetadata restoreMetadata; if (projectStyle == ProjectStyle.PackagesConfig) { restoreMetadata = new PackagesConfigProjectRestoreMetadata { PackagesConfigPath = projectStyleResult.PackagesConfigFilePath, RepositoryPath = GetRepositoryPath(project, settings) }; } else { restoreMetadata = new ProjectRestoreMetadata { CrossTargeting = (projectStyle == ProjectStyle.PackageReference || projectStyle == ProjectStyle.DotnetToolReference) && projectsByTargetFramework.Count > 1, FallbackFolders = BuildTasksUtility.GetFallbackFolders( project.Directory, project.SplitPropertyValueOrNull("RestoreFallbackFolders"), project.SplitPropertyValueOrNull("RestoreFallbackFoldersOverride"), innerNodes.SelectMany(i => MSBuildStringUtility.Split(i.GetProperty("RestoreAdditionalProjectFallbackFolders"))), innerNodes.SelectMany(i => MSBuildStringUtility.Split(i.GetProperty("RestoreAdditionalProjectFallbackFoldersExcludes"))), settings), SkipContentFileWrite = IsLegacyProject(project), ValidateRuntimeAssets = project.IsPropertyTrue("ValidateRuntimeIdentifierCompatibility") }; } restoreMetadata.CacheFilePath = NoOpRestoreUtilities.GetProjectCacheFilePath(outputPath, project.FullPath); restoreMetadata.ConfigFilePaths = settings.GetConfigFilePaths(); restoreMetadata.OutputPath = outputPath; restoreMetadata.OriginalTargetFrameworks = GetOriginalTargetFrameworks(project, projectsByTargetFramework.Keys.ToList()); restoreMetadata.PackagesPath = GetPackagesPath(project, settings); restoreMetadata.ProjectName = projectName; restoreMetadata.ProjectPath = project.FullPath; restoreMetadata.ProjectStyle = projectStyle; restoreMetadata.ProjectUniqueName = project.FullPath; restoreMetadata.ProjectWideWarningProperties = WarningProperties.GetWarningProperties(project.GetProperty("TreatWarningsAsErrors"), project.GetProperty("WarningsAsErrors"), project.GetProperty("NoWarn")); restoreMetadata.RestoreLockProperties = new RestoreLockProperties(project.GetProperty("RestorePackagesWithLockFile"), project.GetProperty("NuGetLockFilePath"), project.IsPropertyTrue("RestoreLockedMode")); restoreMetadata.Sources = GetSources(project, innerNodes, settings); restoreMetadata.TargetFrameworks = GetProjectRestoreMetadataFrameworkInfos(projectsByTargetFramework); return(restoreMetadata, targetFrameworkInfos); }
/// <summary> /// True if ReferenceOutputAssembly is true or empty. /// All other values will be false. /// </summary> private static bool IsReferenceOutputAssemblyTrueOrEmpty(IVsReferenceItem item) { var value = GetPropertyValueOrNull(item, ProjectBuildProperties.ReferenceOutputAssembly); return(MSBuildStringUtility.IsTrueOrEmpty(value)); }
private async Task <bool> ExecuteAsync(Common.ILogger log) { if (RestoreGraphItems.Length < 1) { log.LogWarning(Strings.NoProjectsProvidedToTask); return(true); } // Set user agent and connection settings. ConfigureProtocol(); // Convert to the internal wrapper var wrappedItems = RestoreGraphItems.Select(MSBuildUtility.WrapMSBuildItem); //var graphLines = RestoreGraphItems; var providerCache = new RestoreCommandProvidersCache(); using (var cacheContext = new SourceCacheContext()) { cacheContext.NoCache = RestoreNoCache; cacheContext.IgnoreFailedSources = RestoreIgnoreFailedSources; // Pre-loaded request provider containing the graph file var providers = new List <IPreLoadedRestoreRequestProvider>(); var dgFile = MSBuildRestoreUtility.GetDependencySpec(wrappedItems); if (dgFile.Restore.Count < 1) { // Restore will fail if given no inputs, but here we should skip it and provide a friendly message. log.LogMinimal(Strings.NoProjectsToRestore); return(true); } // Add all child projects if (RestoreRecursive) { BuildTasksUtility.AddAllProjectsForRestore(dgFile); } providers.Add(new DependencyGraphSpecRequestProvider(providerCache, dgFile)); var defaultSettings = Settings.LoadDefaultSettings(root: null, configFileName: null, machineWideSettings: null); var sourceProvider = new CachingSourceProvider(new PackageSourceProvider(defaultSettings)); var restoreContext = new RestoreArgs() { CacheContext = cacheContext, LockFileVersion = LockFileFormat.Version, ConfigFile = MSBuildStringUtility.TrimAndGetNullForEmpty(RestoreConfigFile), DisableParallel = RestoreDisableParallel, GlobalPackagesFolder = RestorePackagesPath, Log = log, MachineWideSettings = new XPlatMachineWideSetting(), PreLoadedRequestProviders = providers, CachingSourceProvider = sourceProvider, AllowNoOp = !RestoreForce, HideWarningsAndErrors = HideWarningsAndErrors }; if (!string.IsNullOrEmpty(RestoreSources)) { var sources = MSBuildStringUtility.Split(RestoreSources); restoreContext.Sources.AddRange(sources); } if (restoreContext.DisableParallel) { HttpSourceResourceProvider.Throttle = SemaphoreSlimThrottle.CreateBinarySemaphore(); } _cts.Token.ThrowIfCancellationRequested(); var restoreSummaries = await RestoreRunner.RunAsync(restoreContext, _cts.Token); // Summary RestoreSummary.Log(log, restoreSummaries); return(restoreSummaries.All(x => x.Success)); } }
/// <summary> /// This method does two important things: /// 1. Normalizes string parameters, trimming whitespace and coalescing empty strings to null. /// 2. Wrap <see cref="ITaskItem"/> instances to facility unit testing. /// </summary> private IPackTaskRequest <IMSBuildItem> GetRequest() { return(new PackTaskRequest { AllowedOutputExtensionsInPackageBuildOutputFolder = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(AllowedOutputExtensionsInPackageBuildOutputFolder), AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(AllowedOutputExtensionsInSymbolsPackageBuildOutputFolder), AssemblyName = MSBuildStringUtility.TrimAndGetNullForEmpty(AssemblyName), Authors = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(Authors), BuildOutputInPackage = MSBuildUtility.WrapMSBuildItem(BuildOutputInPackage), BuildOutputFolders = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(BuildOutputFolders), ContinuePackingAfterGeneratingNuspec = ContinuePackingAfterGeneratingNuspec, ContentTargetFolders = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(ContentTargetFolders), Copyright = MSBuildStringUtility.TrimAndGetNullForEmpty(Copyright), Description = MSBuildStringUtility.TrimAndGetNullForEmpty(Description), DevelopmentDependency = DevelopmentDependency, FrameworkAssemblyReferences = MSBuildUtility.WrapMSBuildItem(FrameworkAssemblyReferences), FrameworksWithSuppressedDependencies = MSBuildUtility.WrapMSBuildItem(FrameworksWithSuppressedDependencies), IconUrl = MSBuildStringUtility.TrimAndGetNullForEmpty(IconUrl), IncludeBuildOutput = IncludeBuildOutput, IncludeSource = IncludeSource, IncludeSymbols = IncludeSymbols, InstallPackageToOutputPath = InstallPackageToOutputPath, IsTool = IsTool, LicenseUrl = MSBuildStringUtility.TrimAndGetNullForEmpty(LicenseUrl), Logger = Logger, MinClientVersion = MSBuildStringUtility.TrimAndGetNullForEmpty(MinClientVersion), NoDefaultExcludes = NoDefaultExcludes, NoPackageAnalysis = NoPackageAnalysis, NuspecBasePath = MSBuildStringUtility.TrimAndGetNullForEmpty(NuspecBasePath), NuspecFile = MSBuildStringUtility.TrimAndGetNullForEmpty(NuspecFile), NuspecOutputPath = MSBuildStringUtility.TrimAndGetNullForEmpty(NuspecOutputPath), NuspecProperties = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(NuspecProperties), OutputFileNamesWithoutVersion = OutputFileNamesWithoutVersion, PackageFiles = MSBuildUtility.WrapMSBuildItem(PackageFiles), PackageFilesToExclude = MSBuildUtility.WrapMSBuildItem(PackageFilesToExclude), PackageId = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageId), PackageOutputPath = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageOutputPath), PackageTypes = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(PackageTypes), PackageVersion = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageVersion), PackItem = MSBuildUtility.WrapMSBuildItem(PackItem), ProjectReferencesWithVersions = MSBuildUtility.WrapMSBuildItem(ProjectReferencesWithVersions), ProjectUrl = MSBuildStringUtility.TrimAndGetNullForEmpty(ProjectUrl), ReleaseNotes = MSBuildStringUtility.TrimAndGetNullForEmpty(ReleaseNotes), RepositoryType = MSBuildStringUtility.TrimAndGetNullForEmpty(RepositoryType), RepositoryUrl = MSBuildStringUtility.TrimAndGetNullForEmpty(RepositoryUrl), RepositoryBranch = MSBuildStringUtility.TrimAndGetNullForEmpty(RepositoryBranch), RepositoryCommit = MSBuildStringUtility.TrimAndGetNullForEmpty(RepositoryCommit), RequireLicenseAcceptance = RequireLicenseAcceptance, RestoreOutputPath = MSBuildStringUtility.TrimAndGetNullForEmpty(RestoreOutputPath), Serviceable = Serviceable, SourceFiles = MSBuildUtility.WrapMSBuildItem(SourceFiles), SymbolPackageFormat = MSBuildStringUtility.TrimAndGetNullForEmpty(SymbolPackageFormat), Tags = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(Tags), TargetFrameworks = MSBuildStringUtility.TrimAndExcludeNullOrEmpty(TargetFrameworks), TargetPathsToSymbols = MSBuildUtility.WrapMSBuildItem(TargetPathsToSymbols), Title = MSBuildStringUtility.TrimAndGetNullForEmpty(Title), TreatWarningsAsErrors = MSBuildStringUtility.TrimAndGetNullForEmpty(TreatWarningsAsErrors), NoWarn = MSBuildStringUtility.TrimAndGetNullForEmpty(NoWarn), WarningsAsErrors = MSBuildStringUtility.TrimAndGetNullForEmpty(WarningsAsErrors), PackageLicenseExpression = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageLicenseExpression), PackageLicenseFile = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageLicenseFile), PackageLicenseExpressionVersion = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageLicenseExpressionVersion), Deterministic = Deterministic, PackageIcon = MSBuildStringUtility.TrimAndGetNullForEmpty(PackageIcon), }); }
public static bool HasCondition(XElement element, string condition) { var elementCondition = MSBuildStringUtility.TrimAndGetNullForEmpty(element.Attribute(XName.Get("Condition"))?.Value); return(StringComparer.OrdinalIgnoreCase.Equals(MSBuildStringUtility.TrimAndGetNullForEmpty(condition), elementCondition)); }
public static bool IsNuGetLockFileEnabled(PackageSpec project) { var restorePackagesWithLockFile = project.RestoreMetadata?.RestoreLockProperties.RestorePackagesWithLockFile; return(MSBuildStringUtility.IsTrue(restorePackagesWithLockFile) || File.Exists(GetNuGetLockFilePath(project))); }
/// <summary> /// Splits the value of the specified property and returns an array if the property has a value, otherwise returns <code>null</code>. /// </summary> /// <param name="item">The <see cref="IMSBuildItem" /> to get the property value from.</param> /// <param name="name">The name of the property to get the value of and split.</param> /// <returns>A <see cref="T:string[]" /> containing the split value of the property if the property had a value, otherwise <code>null</code>.</returns> public static string[] SplitGlobalPropertyValueOrNull(this IMSBuildProject item, string name) { string value = item.GetGlobalProperty(name); return(value == null ? null : MSBuildStringUtility.Split(value)); }
internal static TargetFrameworkInformation ToTargetFrameworkInformation( IVsTargetFrameworkInfo targetFrameworkInfo, bool cpvmEnabled, string projectFullPath) { var tfi = new TargetFrameworkInformation { FrameworkName = GetTargetFramework(targetFrameworkInfo.Properties, projectFullPath), TargetAlias = GetPropertyValueOrNull(targetFrameworkInfo.Properties, ProjectBuildProperties.TargetFramework) }; var ptf = MSBuildStringUtility.Split(GetPropertyValueOrNull(targetFrameworkInfo.Properties, ProjectBuildProperties.PackageTargetFallback)) .Select(NuGetFramework.Parse) .ToList(); var atf = MSBuildStringUtility.Split(GetPropertyValueOrNull(targetFrameworkInfo.Properties, ProjectBuildProperties.AssetTargetFallback)) .Select(NuGetFramework.Parse) .ToList(); // Update TFI with fallback properties AssetTargetFallbackUtility.ApplyFramework(tfi, ptf, atf); tfi.RuntimeIdentifierGraphPath = GetPropertyValueOrNull(targetFrameworkInfo.Properties, ProjectBuildProperties.RuntimeIdentifierGraphPath); if (targetFrameworkInfo.PackageReferences != null) { tfi.Dependencies.AddRange( targetFrameworkInfo.PackageReferences .Cast <IVsReferenceItem>() .Select(pr => ToPackageLibraryDependency(pr, cpvmEnabled))); } if (targetFrameworkInfo is IVsTargetFrameworkInfo2 targetFrameworkInfo2) { if (targetFrameworkInfo2.PackageDownloads != null) { tfi.DownloadDependencies.AddRange( targetFrameworkInfo2.PackageDownloads .Cast <IVsReferenceItem>() .Select(ToPackageDownloadDependency)); } if (cpvmEnabled && targetFrameworkInfo is IVsTargetFrameworkInfo3 targetFrameworkInfo3) { if (targetFrameworkInfo3.CentralPackageVersions != null) { tfi.CentralPackageVersions.AddRange( targetFrameworkInfo3.CentralPackageVersions .Cast <IVsReferenceItem>() .Select(ToCentralPackageVersion) .Distinct(CentralPackageVersionNameComparer.Default) .ToDictionary(cpv => cpv.Name)); } } if (targetFrameworkInfo2.FrameworkReferences != null) { PopulateFrameworkDependencies(tfi, targetFrameworkInfo2); } } return(tfi); }
public async Task NominateProjectAsync_WithRestoreAdditionalSourcesAndFallbackFolders(string restoreSources, string restoreAdditionalProjectSources, string restoreFallbackFolders, string restoreAdditionalFallbackFolders) { var cps = NewCpsProject(@"{ }"); var pri = cps.Builder .WithTool("Foo.Test", "2.0.0") .WithTargetFrameworkInfo( new VsTargetFrameworkInfo( "netcoreapp2.0", Enumerable.Empty <IVsReferenceItem>(), Enumerable.Empty <IVsReferenceItem>(), new[] { new VsProjectProperty("RestoreSources", restoreSources), new VsProjectProperty("RestoreFallbackFolders", restoreFallbackFolders), new VsProjectProperty("RestoreAdditionalProjectSources", restoreAdditionalProjectSources), new VsProjectProperty("RestoreAdditionalProjectFallbackFolders", restoreAdditionalFallbackFolders) })) .Build(); var projectFullPath = cps.ProjectFullPath; // Act var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri); // Assert SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec); var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath); Assert.NotNull(actualProjectSpec); var specSources = actualProjectSpec.RestoreMetadata.Sources?.Select(e => e.Source); var expectedSources = (MSBuildStringUtility.Split(restoreSources).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ? new string[] { "Clear" } : MSBuildStringUtility.Split(restoreSources)). Concat( restoreAdditionalProjectSources != null ? new List <string>() { VSRestoreSettingsUtilities.AdditionalValue }.Concat(MSBuildStringUtility.Split(restoreAdditionalProjectSources)): new string[] { } ); Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t))); var specFallback = actualProjectSpec.RestoreMetadata.FallbackFolders; var expectedFallback = (MSBuildStringUtility.Split(restoreFallbackFolders).Any(e => StringComparer.OrdinalIgnoreCase.Equals("clear", e)) ? new string[] { "Clear" } : MSBuildStringUtility.Split(restoreFallbackFolders)). Concat( restoreAdditionalFallbackFolders != null ? new List <string>() { VSRestoreSettingsUtilities.AdditionalValue }.Concat(MSBuildStringUtility.Split(restoreAdditionalFallbackFolders)) : new string[] { } ); Assert.True( Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t)), "expected: " + string.Join(",", expectedFallback.ToArray()) + "\nactual: " + string.Join(",", specFallback.ToArray())); }
public async Task NominateProjectAsync_WithCliTool_RestoreSettings( string toolFramework, string restorePackagesPath, string restoreSources, string fallbackFolders) { var expectedToolFramework = NuGetFramework.Parse(toolFramework); var cps = NewCpsProject(@"{ }"); var pri = cps.Builder .WithTool("Foo.Test.Tools", "2.0.0") .WithTargetFrameworkInfo( new VsTargetFrameworkInfo( "netcoreapp2.0", Enumerable.Empty <IVsReferenceItem>(), Enumerable.Empty <IVsReferenceItem>(), new[] { new VsProjectProperty("RestorePackagesPath", restorePackagesPath), new VsProjectProperty("RestoreSources", restoreSources), new VsProjectProperty("RestoreFallbackFolders", fallbackFolders), new VsProjectProperty("DotnetCliToolTargetFramework", toolFramework) })) .Build(); var projectFullPath = cps.ProjectFullPath; // Act var actualRestoreSpec = await CaptureNominateResultAsync(projectFullPath, pri); // Assert SpecValidationUtility.ValidateDependencySpec(actualRestoreSpec); var actualProjectSpec = actualRestoreSpec.GetProjectSpec(projectFullPath); Assert.NotNull(actualProjectSpec); var actualToolSpec = actualRestoreSpec .Projects .Where(p => !object.ReferenceEquals(p, actualProjectSpec)) .Single(); var actualMetadata = actualToolSpec.RestoreMetadata; Assert.NotNull(actualMetadata); Assert.Equal(projectFullPath, actualMetadata.ProjectPath); Assert.Equal(ProjectStyle.DotnetCliTool, actualMetadata.ProjectStyle); Assert.Null(actualMetadata.OutputPath); var actualToolFramework = actualToolSpec .TargetFrameworks .Single() .FrameworkName; Assert.Equal(expectedToolFramework, actualToolFramework); var actualToolLibrary = actualToolSpec .TargetFrameworks .Single() .Dependencies .Single(); Assert.Equal("Foo.Test.Tools", actualToolLibrary.Name); Assert.Equal("2.0.0", actualToolLibrary.LibraryRange.VersionRange.OriginalString); Assert.Equal(restorePackagesPath, actualToolSpec.RestoreMetadata.PackagesPath); var specSources = actualToolSpec.RestoreMetadata.Sources?.Select(e => e.Source); var expectedSources = MSBuildStringUtility.Split(restoreSources); Assert.True(Enumerable.SequenceEqual(expectedSources.OrderBy(t => t), specSources.OrderBy(t => t))); var specFallback = actualToolSpec.RestoreMetadata.FallbackFolders; var expectedFallback = MSBuildStringUtility.Split(fallbackFolders); Assert.True(Enumerable.SequenceEqual(expectedFallback.OrderBy(t => t), specFallback.OrderBy(t => t))); }
/// <summary> /// Emulates a JSON deserialization from project.json to PackageSpec in a post-project.json world /// </summary> private async Task <PackageSpec> GetPackageSpecAsync(ISettings settings) { await _threadingService.JoinableTaskFactory.SwitchToMainThreadAsync(); var projectReferences = await ProjectServices .ReferencesReader .GetProjectReferencesAsync(Common.NullLogger.Instance, CancellationToken.None); var targetFramework = await _vsProjectAdapter.GetTargetFrameworkAsync(); var packageReferences = (await ProjectServices .ReferencesReader .GetPackageReferencesAsync(targetFramework, CancellationToken.None)) .ToList(); var packageTargetFallback = MSBuildStringUtility.Split(_vsProjectAdapter.PackageTargetFallback) .Select(NuGetFramework.Parse) .ToList(); var assetTargetFallback = MSBuildStringUtility.Split(_vsProjectAdapter.AssetTargetFallback) .Select(NuGetFramework.Parse) .ToList(); var projectTfi = new TargetFrameworkInformation { FrameworkName = targetFramework, Dependencies = packageReferences, }; // Apply fallback settings AssetTargetFallbackUtility.ApplyFramework(projectTfi, packageTargetFallback, assetTargetFallback); // Build up runtime information. var runtimes = await _vsProjectAdapter.GetRuntimeIdentifiersAsync(); var supports = await _vsProjectAdapter.GetRuntimeSupportsAsync(); var runtimeGraph = new RuntimeGraph(runtimes, supports); // In legacy CSProj, we only have one target framework per project var tfis = new TargetFrameworkInformation[] { projectTfi }; var projectName = _projectName ?? _projectUniqueName; return(new PackageSpec(tfis) { Name = projectName, Version = new NuGetVersion(_vsProjectAdapter.Version), Authors = new string[] { }, Owners = new string[] { }, Tags = new string[] { }, ContentFiles = new string[] { }, FilePath = _projectFullPath, RuntimeGraph = runtimeGraph, RestoreMetadata = new ProjectRestoreMetadata { ProjectStyle = ProjectStyle.PackageReference, OutputPath = GetMSBuildProjectExtensionsPath(), ProjectPath = _projectFullPath, ProjectName = projectName, ProjectUniqueName = _projectFullPath, OriginalTargetFrameworks = tfis .Select(tfi => tfi.FrameworkName.GetShortFolderName()) .ToList(), TargetFrameworks = new List <ProjectRestoreMetadataFrameworkInfo> { new ProjectRestoreMetadataFrameworkInfo(tfis[0].FrameworkName) { ProjectReferences = projectReferences?.ToList() } }, SkipContentFileWrite = true, CacheFilePath = await GetCacheFilePathAsync(), PackagesPath = GetPackagesPath(settings), Sources = GetSources(settings), FallbackFolders = GetFallbackFolders(settings), ConfigFilePaths = GetConfigFilePaths(settings), ProjectWideWarningProperties = WarningProperties.GetWarningProperties( treatWarningsAsErrors: _vsProjectAdapter.TreatWarningsAsErrors, noWarn: _vsProjectAdapter.NoWarn, warningsAsErrors: _vsProjectAdapter.WarningsAsErrors) } }); }