コード例 #1
0
ファイル: NuBuildPropertyPage.cs プロジェクト: madkat/NuBuild
        /// <summary>
        /// Retrieves property values from the project file
        /// </summary>
        protected override void BindProperties()
        {
            var targetFwStr = this.ProjectMgr.GetProjectProperty("TargetFrameworkVersion");

            if (targetFwStr == "v4.0")
            {
                this.targetFramework = VS.TargetFramework.Net40;
            }
            else
            {
                this.targetFramework = VS.TargetFramework.Net45;
            }
            this.outputPath = this.ProjectMgr.GetProjectProperty(
                "OutputPath",
                true
                );
            this.versionSource = (VersionSource)Enum.Parse(
                typeof(VersionSource),
                this.ProjectMgr.GetProjectProperty("NuBuildVersionSource", true),
                true
                );
            this.versionFileName = Boolean.Parse(
                this.ProjectMgr.GetProjectProperty("NuBuildVersionFileName")
                );
            this.addBinariesToSubfolder = Boolean.Parse(
                this.ProjectMgr.GetProjectProperty("NuBuildAddBinariesToSubfolder")
                );
            this.includePdbs = Boolean.Parse(
                this.ProjectMgr.GetProjectProperty("NuBuildIncludePdbs")
                );
        }
コード例 #2
0
        /// <summary>
        /// Task execution override
        /// </summary>
        /// <returns>
        /// True if successful
        /// False otherwise
        /// </returns>
        public override Boolean Execute()
        {
            try
            {
                // parepare the task for execution
                if (this.ReferenceLibraries == null)
                {
                    this.ReferenceLibraries = new ITaskItem[0];
                }
                if (!Path.IsPathRooted(this.OutputPath))
                {
                    this.OutputPath = Path.GetFullPath(this.OutputPath);
                }
                propertyProvider = new PropertyProvider(ProjectPath, this.ReferenceLibraries
                                                        .ValidReferenceLibraryForBinaryNuSource()
                                                        .ValidReferenceLibraryForPropertyProvider()
                                                        .ToArray());

                // add binary and NuBuild build dependencies to the list of sources
                this.sourceList.AddRange(this.ReferenceLibraries
                                         .ValidReferenceLibraryForBinaryNuSource());
                this.sourceList.AddRange(this.ReferenceLibraries
                                         .ValidReferenceLibraryForNuBuildNuSource()
                                         .Select(referenceLibrary => new TaskItem(ProjectHelper.GetNupkgsFullPath(
                                                                                      referenceLibrary.MSBuildSourceProjectFile(), Path.GetDirectoryName(referenceLibrary.FullPath())))));
                // add build dependencies from the embedded resource file(s)
                this.sourceList.AddRange(this.Embedded);

                // parse the version source name
                this.versionSource = (VersionSource)Enum.Parse(
                    typeof(VersionSource),
                    this.VersionSource,
                    true
                    );
                // configure each nuspec item (NuPackage will use the metadata added now)
                // it also adds the referred files in .nuspec files to the sources
                // and certainly adds the .nuspec files to sources and the .nupkg files to targets
                foreach (var specItem in this.NuSpec)
                {
                    PreparePackage(specItem);
                }
                // add intermediate .nupkgs file to targets
                var nupkgsFullPath = ProjectHelper.GetNupkgsFullPath(ProjectPath, OutputPath);
                this.targetList.Add(new TaskItem(nupkgsFullPath));

                // return the list of build sources/targets
                this.Prepared = this.preparedList.ToArray();
                this.Sources  = this.sourceList.ToArray();
                this.Targets  = this.targetList.ToArray();
            }
            catch (Exception e)
            {
                Log.LogError("{0} ({1})", e.ToString(), e.GetType().Name);
                return(false);
            }
            return(true);
        }
コード例 #3
0
ファイル: NuPrepare.cs プロジェクト: wesleygrimes/NuBuild
        /// <summary>
        /// Task execution override
        /// </summary>
        /// <returns>
        /// True if successful
        /// False otherwise
        /// </returns>
        public override Boolean Execute()
        {
            try
            {
                // parepare the task for execution
                if (this.ReferenceLibraries == null)
                {
                    this.ReferenceLibraries = new ITaskItem[0];
                }

                this.OutputPath = Path.GetFullPath(this.OutputPath);
                Directory.CreateDirectory(this.OutputPath);
                // add build dependencies from the nuspec file(s)
                // and the list of project references
                this.sourceList.AddRange(this.NuSpec);
                this.sourceList.AddRange(this.ReferenceLibraries);
                // parse the version source name
                this.versionSource = (VersionSource)Enum.Parse(
                    typeof(VersionSource),
                    this.VersionSource,
                    true
                    );
                // configure each nuspec item
                foreach (var specItem in this.NuSpec)
                {
                    PreparePackage(specItem);
                }
                // return the list of build sources/targets
                this.Sources = this.sourceList.ToArray();
                this.Targets = this.targetList.ToArray();
            }
            catch (Exception e)
            {
                Log.LogError("{0} ({1})", e.Message, e.GetType().Name);
                return(false);
            }
            return(true);
        }
コード例 #4
0
ファイル: NuPrepare.cs プロジェクト: bspell1/NuBuild
        /// <summary>
        /// Task execution override
        /// </summary>
        /// <returns>
        /// True if successful
        /// False otherwise
        /// </returns>
        public override Boolean Execute()
        {
            try
            {
                // parepare the task for execution
                if (this.ReferenceLibraries == null)
                    this.ReferenceLibraries = new ITaskItem[0];

                this.OutputPath = Path.GetFullPath(this.OutputPath);
                Directory.CreateDirectory(this.OutputPath);
                // add build dependencies from the nuspec file(s)
                // and the list of project references
                this.sourceList.AddRange(this.NuSpec);
                this.sourceList.AddRange(this.ReferenceLibraries);
                // parse the version source name
                this.versionSource = (VersionSource)Enum.Parse(
                   typeof(VersionSource),
                   this.VersionSource,
                   true
                );
                // configure each nuspec item
                foreach (var specItem in this.NuSpec)
                    PreparePackage(specItem);
                // return the list of build sources/targets
                this.Sources = this.sourceList.ToArray();
                this.Targets = this.targetList.ToArray();
            }
            catch (Exception e)
            {
                Log.LogError("{0} ({1})", e.Message, e.GetType().Name);
                return false;
            }
            return true;
        }
コード例 #5
0
ファイル: NuBuildPropertyPage.cs プロジェクト: keeger/NuBuild
 /// <summary>
 /// Retrieves property values from the project file
 /// </summary>
 protected override void BindProperties()
 {
     var targetFwStr = this.ProjectMgr.GetProjectProperty("TargetFrameworkVersion");
      if (targetFwStr == "v4.0")
     this.targetFramework = VS.TargetFramework.Net40;
      else
     this.targetFramework = VS.TargetFramework.Net45;
      this.outputPath = this.ProjectMgr.GetProjectProperty(
     "OutputPath",
     true
      );
      this.versionSource = (VersionSource)Enum.Parse(
     typeof(VersionSource),
     this.ProjectMgr.GetProjectProperty("NuBuildVersionSource", true),
     true
      );
      this.versionFileName = Boolean.Parse(
     this.ProjectMgr.GetProjectProperty("NuBuildVersionFileName")
      );
      this.addBinariesToSubfolder = Boolean.Parse(
     this.ProjectMgr.GetProjectProperty("NuBuildAddBinariesToSubfolder")
      );
      this.autoGenerateDependencies = Boolean.Parse(
     this.ProjectMgr.GetProjectProperty("NuBuildAutoGenerateDependencies")
      );
      this.includePdbs = Boolean.Parse(
     this.ProjectMgr.GetProjectProperty("NuBuildIncludePdbs")
      );
 }