public MSBuildNuGetProject( IMSBuildProjectSystem msbuildNuGetProjectSystem, string folderNuGetProjectPath, string packagesConfigFolderPath) { if (folderNuGetProjectPath == null) { throw new ArgumentNullException(nameof(folderNuGetProjectPath)); } if (packagesConfigFolderPath == null) { throw new ArgumentNullException(nameof(packagesConfigFolderPath)); } ProjectStyle = ProjectStyle.PackagesConfig; ProjectSystem = msbuildNuGetProjectSystem ?? throw new ArgumentNullException(nameof(msbuildNuGetProjectSystem)); FolderNuGetProject = new FolderNuGetProject(folderNuGetProjectPath); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, ProjectSystem.ProjectName); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, ProjectSystem.TargetFramework); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, msbuildNuGetProjectSystem.ProjectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, msbuildNuGetProjectSystem.ProjectUniqueName); PackagesConfigNuGetProject = new PackagesConfigNuGetProject(packagesConfigFolderPath, InternalMetadata); }
public NetCorePackageReferenceProject( string projectName, string projectUniqueName, string projectFullPath, IProjectSystemCache projectSystemCache, IVsProjectAdapter vsProjectAdapter, UnconfiguredProject unconfiguredProject, INuGetProjectServices projectServices, string projectId) { Assumes.Present(projectFullPath); Assumes.Present(projectSystemCache); Assumes.Present(projectServices); _projectName = projectName; _projectUniqueName = projectUniqueName; _projectFullPath = projectFullPath; ProjectStyle = ProjectStyle.PackageReference; _projectSystemCache = projectSystemCache; _vsProjectAdapter = vsProjectAdapter; _unconfiguredProject = unconfiguredProject; ProjectServices = projectServices; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, _projectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); }
public CpsPackageReferenceProject( string projectName, string projectUniqueName, string projectFullPath, IProjectSystemCache projectSystemCache, EnvDTEProject envDTEProject, UnconfiguredProject unconfiguredProject, string projectId) { if (projectFullPath == null) { throw new ArgumentNullException(nameof(projectFullPath)); } if (projectSystemCache == null) { throw new ArgumentNullException(nameof(projectSystemCache)); } _projectName = projectName; _projectUniqueName = projectUniqueName; _projectFullPath = projectFullPath; _projectSystemCache = projectSystemCache; _envDTEProject = envDTEProject; _unconfiguredProject = unconfiguredProject; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, _projectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); }
public NetCorePackageReferenceProject( string projectName, string projectUniqueName, string projectFullPath, IProjectSystemCache projectSystemCache, IVsProjectAdapter vsProjectAdapter, UnconfiguredProject unconfiguredProject, string projectId) { if (projectFullPath == null) { throw new ArgumentNullException(nameof(projectFullPath)); } if (projectSystemCache == null) { throw new ArgumentNullException(nameof(projectSystemCache)); } _projectName = projectName; _projectUniqueName = projectUniqueName; _projectFullPath = projectFullPath; ProjectStyle = ProjectStyle.PackageReference; _projectSystemCache = projectSystemCache; _vsProjectAdapter = vsProjectAdapter; _unconfiguredProject = unconfiguredProject; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, _projectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); }
public ProjectJsonBuildIntegratedProjectSystem( string jsonConfigPath, string msbuildProjectFilePath, EnvDTEProject envDTEProject, string uniqueName) : base(jsonConfigPath, msbuildProjectFilePath) { _envDTEProject = envDTEProject; // set project id var projectId = VsHierarchyUtility.GetProjectId(envDTEProject); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); // Override the JSON TFM value from the csproj for UAP framework if (InternalMetadata.TryGetValue(NuGetProjectMetadataKeys.TargetFramework, out object targetFramework)) { var jsonTargetFramework = targetFramework as NuGetFramework; if (IsUAPFramework(jsonTargetFramework)) { var platfromMinVersion = VsHierarchyUtility.GetMSBuildProperty(VsHierarchyUtility.ToVsHierarchy(envDTEProject), EnvDTEProjectInfoUtility.TargetPlatformMinVersion); if (!string.IsNullOrEmpty(platfromMinVersion)) { // Found the TPMinV in csproj, store this as a new target framework to be replaced in project.json var newTargetFramework = new NuGetFramework(jsonTargetFramework.Framework, new Version(platfromMinVersion)); InternalMetadata[NuGetProjectMetadataKeys.TargetFramework] = newTargetFramework; } } } InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName); }
public LegacyPackageReferenceProject( IVsProjectAdapter vsProjectAdapter, string projectId, INuGetProjectServices projectServices, IVsProjectThreadingService threadingService) { Assumes.Present(vsProjectAdapter); Assumes.NotNullOrEmpty(projectId); Assumes.Present(projectServices); Assumes.Present(threadingService); _vsProjectAdapter = vsProjectAdapter; _threadingService = threadingService; _projectName = _vsProjectAdapter.ProjectName; _projectUniqueName = _vsProjectAdapter.UniqueName; _projectFullPath = _vsProjectAdapter.FullProjectPath; ProjectStyle = ProjectStyle.PackageReference; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, _projectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); ProjectServices = projectServices; }
public TestPackageReferenceProject(string projectUniqueName) { _projectName = projectUniqueName; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectName); }
public CpsPackageReferenceProject( string projectName, string projectUniqueName, string projectFullPath, IProjectSystemCache projectSystemCache, UnconfiguredProject unconfiguredProject, INuGetProjectServices projectServices, string projectId) : base(projectName, projectUniqueName, projectFullPath) { Assumes.Present(projectFullPath); Assumes.Present(projectSystemCache); Assumes.Present(projectServices); ProjectStyle = ProjectStyle.PackageReference; _projectSystemCache = projectSystemCache; _unconfiguredProject = unconfiguredProject; ProjectServices = projectServices; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, ProjectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, ProjectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, ProjectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); }
public MSBuildNuGetProject(IMSBuildNuGetProjectSystem msbuildNuGetProjectSystem, string folderNuGetProjectPath, string packagesConfigFullPath) { if (msbuildNuGetProjectSystem == null) { throw new ArgumentNullException("nugetDotNetProjectSystem"); } if (folderNuGetProjectPath == null) { throw new ArgumentNullException("folderNuGetProjectPath"); } if (packagesConfigFullPath == null) { throw new ArgumentNullException("packagesConfigFullPath"); } MSBuildNuGetProjectSystem = msbuildNuGetProjectSystem; FolderNuGetProject = new FolderNuGetProject(folderNuGetProjectPath); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, MSBuildNuGetProjectSystem.ProjectName); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, MSBuildNuGetProjectSystem.TargetFramework); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, msbuildNuGetProjectSystem.ProjectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, msbuildNuGetProjectSystem.ProjectUniqueName); PackagesConfigNuGetProject = new PackagesConfigNuGetProject(packagesConfigFullPath, InternalMetadata); }
public DotNetCoreNuGetProject( DotNetProject project, IEnumerable <string> targetFrameworks, ConfigurationSelector configuration, IPackageManagementEvents packageManagementEvents) { this.project = project; this.configuration = configuration; this.packageManagementEvents = packageManagementEvents; ProjectStyle = ProjectStyle.PackageReference; var targetFramework = NuGetFramework.UnsupportedFramework; if (targetFrameworks.Count() == 1) { targetFramework = NuGetFramework.Parse(targetFrameworks.First()); } InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, targetFramework); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, project.Name); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, project.BaseDirectory); msbuildProjectPath = project.FileName; projectName = project.Name; }
private void Initialize(string root, PackagePathResolver resolver) { Root = root; PackagePathResolver = resolver; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, root); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, NuGetFramework.AnyFramework); }
/// <summary> /// Project.json based project system. /// </summary> /// <param name="jsonConfig">Path to project.json.</param> /// <param name="msBuildProjectPath">Path to the msbuild project file.</param> public ProjectJsonBuildIntegratedNuGetProject( string jsonConfig, string msBuildProjectPath) { if (jsonConfig == null) { throw new ArgumentNullException(nameof(jsonConfig)); } if (msBuildProjectPath == null) { throw new ArgumentNullException(nameof(msBuildProjectPath)); } _jsonConfig = new FileInfo(jsonConfig); MSBuildProjectPath = msBuildProjectPath; _projectName = Path.GetFileNameWithoutExtension(msBuildProjectPath); if (string.IsNullOrEmpty(_projectName)) { throw new ArgumentException( string.Format(CultureInfo.CurrentCulture, Strings.InvalidProjectName, MSBuildProjectPath)); } JObject projectJson; IEnumerable <NuGetFramework> targetFrameworks = Enumerable.Empty <NuGetFramework>(); try { projectJson = GetJson(); targetFrameworks = JsonConfigUtility.GetFrameworks(projectJson); } catch (InvalidOperationException) { // Ignore a bad project.json when constructing the project, and treat it as unsupported. } // Default to unsupported if anything unexpected is returned var targetFramework = NuGetFramework.UnsupportedFramework; // Having more than one framework is not supported, but we pick the first as fallback // We will eventually support more than one framework ala projectK. if (targetFrameworks.Count() == 1) { targetFramework = targetFrameworks.First(); } InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, targetFramework); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, msBuildProjectPath); var supported = new List <FrameworkName> { new FrameworkName(targetFramework.DotNetFrameworkName) }; InternalMetadata.Add(NuGetProjectMetadataKeys.SupportedFrameworks, supported); }
public PackagingNuGetProject(PackagingProject project) { this.project = project; InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, NuGetFramework.Parse("any")); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, project.Name); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, project.Name); }
public FakeNuGetProject(IDotNetProject project) { Project = project; if (project.Name != null) { InternalMetadata.Add(NuGetProjectMetadataKeys.Name, project.Name); } }
public FolderNuGetProject(string root, PackagePathResolver packagePathResolver) { if (root == null) { throw new ArgumentNullException(nameof(root)); } Root = root; PackagePathResolver = packagePathResolver; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, root); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, NuGetFramework.AnyFramework); }
public TestBuildIntegratedNuGetProject( string jsonConfig, IMSBuildProjectSystem msbuildProjectSystem) : base( jsonConfig, Path.Combine( msbuildProjectSystem.ProjectFullPath, $"{msbuildProjectSystem.ProjectName}.csproj")) { InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, msbuildProjectSystem.ProjectName); ProjectClosure = new List <ExternalProjectReference>(); }
public ProjectKNuGetProject(INuGetPackageManager project, string projectName, string uniqueName) { _project = project; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName); var supportedFrameworks = _project.GetSupportedFrameworksAsync(CancellationToken.None) .Result .Select(f => NuGetFramework.Parse(f.FullName)); InternalMetadata.Add(NuGetProjectMetadataKeys.SupportedFrameworks, supportedFrameworks); }
public BuildIntegratedProjectSystem( string jsonConfigPath, string msbuildProjectFilePath, EnvDTEProject envDTEProject, IMSBuildNuGetProjectSystem msbuildProjectSystem, string uniqueName) : base(jsonConfigPath, msbuildProjectFilePath, msbuildProjectSystem) { InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName); EnvDTEProject = envDTEProject; }
public FolderNuGetProject(string root) { if (root == null) { throw new ArgumentNullException("root"); } Root = root; PackagePathResolver = new PackagePathResolver(root); PackageSaveMode = PackageSaveModes.Nupkg; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, root); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, NuGetFramework.AnyFramework); }
public NetCorePackageReferenceNuGetProject(IProjectAdapter projectAdapter, INuGetProjectServices projectServices, IProjectRestoreService projectRestoreService) { ProjectStyle = ProjectStyle.PackageReference; ProjectAdapter = projectAdapter; _projectRestoreService = projectRestoreService; //ProjectServices = projectServices; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, projectAdapter.ProjectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, projectAdapter.ProjectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, projectAdapter.ProjectFilePath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectAdapter.ProjectId); }
/// <summary> /// Initializes a new <see cref="FolderNuGetProject" /> class. /// </summary> /// <param name="root">The folder project root path.</param> /// <param name="packagePathResolver">A package path resolver.</param> /// <param name="targetFramework">Project target framework.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="root" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="packagePathResolver" /> is <c>null</c>.</exception> /// <exception cref="ArgumentNullException">Thrown if <paramref name="targetFramework" /> is <c>null</c>.</exception> public FolderNuGetProject(string root, PackagePathResolver packagePathResolver, NuGetFramework targetFramework) { if (targetFramework == null) { throw new ArgumentNullException(nameof(targetFramework)); } Root = root ?? throw new ArgumentNullException(nameof(root)); PackagePathResolver = packagePathResolver ?? throw new ArgumentNullException(nameof(packagePathResolver)); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, root); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, targetFramework); _framework = targetFramework; }
public ProjectKNuGetProject(INuGetPackageManager project, string projectName, string uniqueName, string projectId) { _project = project; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); NuGetUIThreadHelper.JoinableTaskFactory.Run(async() => { var frameworks = await _project.GetSupportedFrameworksAsync(CancellationToken.None); var supportedFrameworks = frameworks.Select(f => NuGetFramework.Parse(f.FullName)); InternalMetadata.Add(NuGetProjectMetadataKeys.SupportedFrameworks, supportedFrameworks); }); }
public VSMSBuildNuGetProject( EnvDTEProject project, IMSBuildNuGetProjectSystem msbuildNuGetProjectSystem, string folderNuGetProjectPath, string packagesConfigFolderPath) : base( msbuildNuGetProjectSystem, folderNuGetProjectPath, packagesConfigFolderPath) { _project = project; // set project id var projectId = VsHierarchyUtility.GetProjectId(project); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); }
public ProjectJsonBuildIntegratedProjectSystem( string jsonConfigPath, string msbuildProjectFilePath, EnvDTEProject envDTEProject, string uniqueName) : base(jsonConfigPath, msbuildProjectFilePath) { _envDTEProject = envDTEProject; // set project id var projectId = VsHierarchyUtility.GetProjectId(envDTEProject); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, uniqueName); }
public PackageReferenceNuGetProject( DotNetProject project, IPackageManagementEvents packageManagementEvents) { this.project = project; this.packageManagementEvents = packageManagementEvents; var targetFramework = NuGetFramework.Parse(project.TargetFramework.Id.ToString()); InternalMetadata.Add(NuGetProjectMetadataKeys.TargetFramework, targetFramework); InternalMetadata.Add(NuGetProjectMetadataKeys.Name, project.Name); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, project.BaseDirectory); msbuildProjectPath = project.FileName; projectName = project.Name; }
public VsProjectJsonNuGetProject( string jsonConfigPath, string msbuildProjectFilePath, IVsProjectAdapter vsProjectAdapter, INuGetProjectServices projectServices) : base(jsonConfigPath, msbuildProjectFilePath) { Assumes.Present(vsProjectAdapter); Assumes.Present(projectServices); _vsProjectAdapter = vsProjectAdapter; InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, _vsProjectAdapter.ProjectId); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _vsProjectAdapter.CustomUniqueName); ProjectServices = projectServices; }
public NuGetPluginProject(Func <NuGetPluginProject <TMeta>, NuGetPackageManager> packageManagerCreator, Func <PackageIdentity, bool> canUninstallPackageFunc, NuGetFramework currentFramework, DirectoryPath packageDirPath, DirectoryPath pluginHomeDirPath, LocalPluginPackage <TMeta> plugin, bool isInstalled) : base(packageDirPath.FullPath) { Plugin = plugin; _packageManagerCreator = packageManagerCreator; _canUninstallPackageFunc = canUninstallPackageFunc; _currentFramework = currentFramework; _isInstalled = isInstalled; _pluginHomeDirPath = pluginHomeDirPath.Combine(Plugin.Id); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, plugin.Id); }
public VsMSBuildNuGetProject( IVsProjectAdapter projectAdapter, IMSBuildProjectSystem msbuildNuGetProjectSystem, string folderNuGetProjectPath, string packagesConfigFolderPath, INuGetProjectServices projectServices) : base( msbuildNuGetProjectSystem, folderNuGetProjectPath, packagesConfigFolderPath) { Assumes.Present(projectAdapter); Assumes.Present(msbuildNuGetProjectSystem); Assumes.Present(projectServices); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectAdapter.ProjectId); ProjectServices = projectServices; }
public LegacyCSProjPackageReferenceProject( IEnvDTEProjectAdapter project, string projectId, bool callerIsUnitTest = false) { if (project == null) { throw new ArgumentNullException(nameof(project)); } _project = project; _projectName = _project.Name; _projectUniqueName = _project.UniqueName; _projectFullPath = _project.ProjectFullPath; _callerIsUnitTest = callerIsUnitTest; InternalMetadata.Add(NuGetProjectMetadataKeys.Name, _projectName); InternalMetadata.Add(NuGetProjectMetadataKeys.UniqueName, _projectUniqueName); InternalMetadata.Add(NuGetProjectMetadataKeys.FullPath, _projectFullPath); InternalMetadata.Add(NuGetProjectMetadataKeys.ProjectId, projectId); }