Ejemplo n.º 1
0
        private PackageAsset GetPackageAssetFromTargetPath(string targetPath)
        {
            PackageItem packageItem = null;

            if (!_targetPathToPackageItem.TryGetValue(targetPath, out packageItem))
            {
                throw new ArgumentException($"Could not find source item for {targetPath}", nameof(targetPath));
            }

            var packageAsset = new PackageAsset()
            {
                HarvestedFrom   = packageItem.HarvestedFrom,
                LocalPath       = packageItem.SourcePath,
                PackagePath     = packageItem.TargetPath,
                TargetFramework = packageItem.TargetFramework,
                Version         = packageItem.Version
            };

            if (packageItem.SourceProject != null)
            {
                packageAsset.SourceProject = new BuildProject()
                {
                    Project = packageItem.SourceProject,
                    AdditionalProperties = packageItem.AdditionalProperties,
                    UndefineProperties   = packageItem.UndefineProperties
                };
            }

            return(packageAsset);
        }
 private ITaskItem ItemFromApplicableAsset(PackageAsset asset, string id, string version)
 {
     var item = new TaskItem(asset.LocalPath);
     item.SetMetadata("SourceProject", asset.SourceProject);
     item.SetMetadata("PackagePath", asset.PackagePath);
     item.SetMetadata("NuGetPackageId", id);
     item.SetMetadata("NuGetPackageVersion", version);
     return item;
 }
        private ITaskItem ItemFromApplicableAsset(PackageAsset asset, string id, string version)
        {
            var item = new TaskItem(asset.LocalPath);

            item.SetMetadata("PackagePath", asset.PackagePath);
            item.SetMetadata("NuGetPackageId", id);
            item.SetMetadata("NuGetPackageVersion", version);
            return(item);
        }
Ejemplo n.º 4
0
        private PackageAsset GetPackageAssetFromTargetPath(string targetPath)
        {
            PackageItem packageItem = null;
            if (!_targetPathToPackageItem.TryGetValue(targetPath, out packageItem))
            {
                throw new ArgumentException($"Could not find source item for {targetPath}", nameof(targetPath));
            }

            var packageAsset = new PackageAsset()
            {
                HarvestedFrom = packageItem.HarvestedFrom,
                LocalPath = packageItem.SourcePath,
                PackagePath = packageItem.TargetPath,
                TargetFramework = packageItem.TargetFramework,
                Version = packageItem.Version
            };

            if (packageItem.SourceProject != null)
            {
                packageAsset.SourceProject = new BuildProject()
                {
                    Project = packageItem.SourceProject,
                    AdditionalProperties = packageItem.AdditionalProperties,
                    UndefineProperties = packageItem.UndefineProperties
                };
            }

            return packageAsset;
        }