コード例 #1
0
ファイル: PopperTool.cs プロジェクト: jlyonsmith/CSharpTools
        private ParsedPath GetSlnForProject(ParsedPath csprojPath)
        {
            var files = DirectoryUtility.GetFiles(csprojPath.WithFileAndExtension("*.sln"), SearchScope.RecurseParentDirectories);

            if (files.Count == 0)
                throw new PopperToolExeception("Cannot find .sln for project '{0}'".InvariantFormat(csprojPath));

            return files[0];
        }
コード例 #2
0
ファイル: PopperTool.cs プロジェクト: jlyonsmith/CSharpTools
        private ParsedPath FindNugetLibrary(ParsedPath slnPath, ParsedPath csprojPath)
        {
            var projectName = ProjectName;
            var packagesConfigPath = csprojPath.WithFileAndExtension("packages.config");

            if (!File.Exists(packagesConfigPath))
                throw new PopperToolExeception("Cannot find '{0}'".InvariantFormat(packagesConfigPath));

            var doc = XDocument.Parse(File.ReadAllText(packagesConfigPath));
            var element = doc.Root.Elements("package").Where(e => e.Attribute("id").Value == projectName).FirstOrDefault();

            if (element == null)
                throw new PopperToolExeception("Cannot find project '{0}' in '{1}'".InvariantFormat(projectName, packagesConfigPath));

            var s = "packages/{0}.{1}/lib/{2}/{0}.dll".InvariantFormat(
                projectName, element.Attribute("version").Value, element.Attribute("targetFramework").Value);

            return slnPath.VolumeAndDirectory.Append(s , PathType.File);
        }