public ProjectDescription( LibraryRange libraryRange, Project project, IEnumerable<LibraryRange> dependencies, TargetFrameworkInformation targetFrameworkInfo, bool resolved) : base(new LibraryIdentity(project.Name, project.Version, LibraryType.Project), string.Empty, // Projects don't have hashes project.ProjectFilePath, dependencies, targetFrameworkInfo.FrameworkName, resolved, compatible: true) { Project = project; TargetFrameworkInfo = targetFrameworkInfo; }
/// <summary> /// Parse a Json object which represents project configuration for a specified framework /// </summary> /// <param name="frameworkKey">The name of the framework</param> /// <param name="frameworkValue">The Json object represent the settings</param> /// <returns>Returns true if it successes.</returns> private bool BuildTargetFrameworkNode(Project project, string frameworkKey, JsonObject frameworkValue) { // If no compilation options are provided then figure them out from the node var compilerOptions = GetCompilationOptions(frameworkValue) ?? new CommonCompilerOptions(); var frameworkName = NuGetFramework.Parse(frameworkKey); // If it's not unsupported then keep it if (frameworkName.IsUnsupported) { // REVIEW: Should we skip unsupported target frameworks return false; } // Add the target framework specific define var defines = new HashSet<string>(compilerOptions.Defines ?? Enumerable.Empty<string>()); var frameworkDefine = MakeDefaultTargetFrameworkDefine(frameworkName); if (!string.IsNullOrEmpty(frameworkDefine)) { defines.Add(frameworkDefine); } compilerOptions.Defines = defines; var targetFrameworkInformation = new TargetFrameworkInformation { FrameworkName = frameworkName, Dependencies = new List<LibraryRange>(), CompilerOptions = compilerOptions, Line = frameworkValue.Line, Column = frameworkValue.Column }; var frameworkDependencies = new List<LibraryRange>(); PopulateDependencies( project.ProjectFilePath, frameworkDependencies, frameworkValue, "dependencies", isGacOrFrameworkReference: false); var frameworkAssemblies = new List<LibraryRange>(); PopulateDependencies( project.ProjectFilePath, frameworkAssemblies, frameworkValue, "frameworkAssemblies", isGacOrFrameworkReference: true); frameworkDependencies.AddRange(frameworkAssemblies); targetFrameworkInformation.Dependencies = frameworkDependencies; targetFrameworkInformation.WrappedProject = frameworkValue.ValueAsString("wrappedProject"); var binNode = frameworkValue.ValueAsJsonObject("bin"); if (binNode != null) { targetFrameworkInformation.AssemblyPath = binNode.ValueAsString("assembly"); targetFrameworkInformation.PdbPath = binNode.ValueAsString("pdb"); } project._targetFrameworks[frameworkName] = targetFrameworkInformation; return true; }
/// <summary> /// Parse a Json object which represents project configuration for a specified framework /// </summary> /// <param name="frameworkKey">The name of the framework</param> /// <param name="frameworkValue">The Json object represent the settings</param> /// <returns>Returns true if it successes.</returns> private bool BuildTargetFrameworkNode(Project project, string frameworkKey, JsonObject frameworkValue) { // If no compilation options are provided then figure them out from the node var compilerOptions = GetCompilationOptions(frameworkValue) ?? new CommonCompilerOptions(); var frameworkName = NuGetFramework.Parse(frameworkKey); // If it's not unsupported then keep it if (frameworkName.IsUnsupported) { // REVIEW: Should we skip unsupported target frameworks return(false); } // Add the target framework specific define var defines = new HashSet <string>(compilerOptions.Defines ?? Enumerable.Empty <string>()); var frameworkDefine = MakeDefaultTargetFrameworkDefine(frameworkName); if (!string.IsNullOrEmpty(frameworkDefine)) { defines.Add(frameworkDefine); } compilerOptions.Defines = defines; var targetFrameworkInformation = new TargetFrameworkInformation { FrameworkName = frameworkName, Dependencies = new List <LibraryRange>(), CompilerOptions = compilerOptions, Line = frameworkValue.Line, Column = frameworkValue.Column }; var frameworkDependencies = new List <LibraryRange>(); PopulateDependencies( project.ProjectFilePath, frameworkDependencies, frameworkValue, "dependencies", isGacOrFrameworkReference: false); var frameworkAssemblies = new List <LibraryRange>(); PopulateDependencies( project.ProjectFilePath, frameworkAssemblies, frameworkValue, "frameworkAssemblies", isGacOrFrameworkReference: true); frameworkDependencies.AddRange(frameworkAssemblies); targetFrameworkInformation.Dependencies = frameworkDependencies; targetFrameworkInformation.WrappedProject = frameworkValue.ValueAsString("wrappedProject"); var binNode = frameworkValue.ValueAsJsonObject("bin"); if (binNode != null) { targetFrameworkInformation.AssemblyPath = binNode.ValueAsString("assembly"); targetFrameworkInformation.PdbPath = binNode.ValueAsString("pdb"); } project._targetFrameworks[frameworkName] = targetFrameworkInformation; return(true); }