public bool IsFileIncluded(DeployFile file)
 {
     if (excludedFiles == null)
     {
         return(true);
     }
     return(!excludedFiles.Contains(GetKey(file)));
 }
Exemple #2
0
        public override DeployFileCollection GetProjectDeployFiles(DeployContext ctx, Project project, ConfigurationSelector configuration)
        {
            DeployFileCollection deployFiles = new DeployFileCollection();

            base.GetProjectDeployFiles(ctx, project, configuration);
            // Add the compiled output file

            string outputFile = project.GetOutputFileName(configuration);

            if (!string.IsNullOrEmpty(outputFile))
            {
                deployFiles.Add(new DeployFile(project, outputFile, Path.GetFileName(outputFile), TargetDirectory.ProgramFiles));
            }

            // Collect deployable files
            foreach (ProjectFile file in project.Files)
            {
                // skip CopyToOutputDirectory files when it's just a project build, because
                // MonoDevelop.Project.Projects already copies these files using more subtle overwriting
                // semantics
                if (file.CopyToOutputDirectory != FileCopyMode.None)
                {
                    continue;
                }

                DeployProperties props = new DeployProperties(file);
                if (props.ShouldDeploy)
                {
                    DeployFile dp = new DeployFile(file);
                    deployFiles.Add(dp);

                    if (string.Compare(Path.GetFileName(dp.SourcePath), "app.config", true) == 0 && string.Compare(Path.GetFileName(dp.RelativeTargetPath), "app.config", true) == 0)
                    {
                        string newName = Path.GetFileName(outputFile) + ".config";
                        dp.RelativeTargetPath = Path.Combine(Path.GetDirectoryName(dp.RelativeTargetPath), newName);
                    }
                }
            }

            foreach (FileCopySet.Item item in project.GetSupportFileList(configuration))
            {
                deployFiles.Add(new DeployFile(project, item.Src, item.Target, TargetDirectory.ProgramFiles));
            }

            DotNetProject netProject = project as DotNetProject;

            if (netProject != null)
            {
                DotNetProjectConfiguration conf = (DotNetProjectConfiguration)project.GetConfiguration(configuration);
                if (conf.DebugMode)
                {
                    string mdbFile = netProject.TargetRuntime.GetAssemblyDebugInfoFile(conf.CompiledOutputName);
                    deployFiles.Add(new DeployFile(project, mdbFile, Path.GetFileName(mdbFile), TargetDirectory.ProgramFiles));
                }
            }

            return(deployFiles);
        }
 public virtual bool IncludeFile(DeployFile file)
 {
     if (fileFilter != null)
     {
         return(fileFilter.IsFileIncluded(file));
     }
     else
     {
         return(true);
     }
 }
        void OnToggled(object sender, Gtk.ToggledArgs args)
        {
            TreeIter iter;

            store.GetIterFromString(out iter, args.Path);
            DeployFile file = (DeployFile)store.GetValue(iter, ColObject);
            bool       inc  = !builder.IsFileIncluded(file);

            builder.SetFileIncluded(file, inc);
            store.SetValue(iter, ColIncluded, inc);
        }
 public void SetFileIncluded(DeployFile file, bool included)
 {
     if (excludedFiles == null)
     {
         excludedFiles = new List <string> ();
     }
     excludedFiles.Remove(GetKey(file));
     if (!included)
     {
         excludedFiles.Add(GetKey(file));
     }
 }
        public override DeployFileCollection GetProjectDeployFiles(DeployContext ctx, Project project, ConfigurationSelector configuration)
        {
            DeployFileCollection deployFiles = new DeployFileCollection();

            base.GetProjectDeployFiles(ctx, project, configuration);

            // Add the compiled output files

            ProjectConfiguration pconf  = (ProjectConfiguration)project.GetConfiguration(configuration);
            FilePath             outDir = pconf.OutputDirectory;

            foreach (FilePath file in project.GetOutputFiles(configuration))
            {
                deployFiles.Add(new DeployFile(project, file, file.ToRelative(outDir), TargetDirectory.ProgramFiles));
            }

//			FilePath outputFile = project.GetOutputFileName (configuration);

            // Collect deployable files
            foreach (ProjectFile file in project.Files)
            {
                // skip CopyToOutputDirectory files when it's just a project build, because
                // MonoDevelop.Project.Projects already copies these files using more subtle overwriting
                // semantics
                if (file.CopyToOutputDirectory != FileCopyMode.None)
                {
                    continue;
                }

                DeployProperties props = new DeployProperties(file);
                if (props.ShouldDeploy)
                {
                    DeployFile dp = new DeployFile(file);
                    deployFiles.Add(dp);
                }
            }

            foreach (FileCopySet.Item item in project.GetSupportFileList(configuration))
            {
                deployFiles.Add(new DeployFile(project, item.Src, item.Target, TargetDirectory.ProgramFiles));
            }

            return(deployFiles);
        }
        public override DeployFileCollection GetProjectDeployFiles(DeployContext ctx, Project project, ConfigurationSelector configuration)
        {
            var deployFiles = new DeployFileCollection();

            base.GetProjectDeployFiles(ctx, project, configuration);

            // Add the compiled output files

            var pconf   = (ProjectConfiguration)project.GetConfiguration(configuration);
            var evalCtx = new TargetEvaluationContext();

            evalCtx.ItemsToEvaluate.Add("AllPublishItemsFullPathWithTargetPath");

            if (project.MSBuildProject.UseMSBuildEngine)
            {
                var result = project.RunTarget(new ProgressMonitor(), "GetCopyToPublishDirectoryItems", configuration, evalCtx).Result;
                foreach (var item in result.Items)
                {
                    if (item.Name == "AllPublishItemsFullPathWithTargetPath")
                    {
                        var fromPath = MSBuildProjectService.FromMSBuildPath(project.ItemDirectory, item.Include);
                        var toPath   = item.Metadata.GetPathValue("TargetPath", relativeToPath: pconf.OutputDirectory);
                        deployFiles.Add(new DeployFile(project, fromPath, toPath, TargetDirectory.ProgramFiles));
                    }
                }
            }
            else
            {
#pragma warning disable 618 //obsolete
                FilePath outDir = pconf.OutputDirectory;
                foreach (FilePath file in project.GetOutputFiles(configuration))
                {
                    deployFiles.Add(new DeployFile(project, file, file.ToRelative(outDir), TargetDirectory.ProgramFiles));
                }
                foreach (FileCopySet.Item item in project.GetSupportFileList(configuration))
                {
                    deployFiles.Add(new DeployFile(project, item.Src, item.Target, TargetDirectory.ProgramFiles));
                }
#pragma warning restore 618
            }

            // Collect deployable files
            foreach (ProjectFile file in project.Files)
            {
                // skip CopyToOutputDirectory files when it's just a project build, because
                // MonoDevelop.Project.Projects already copies these files using more subtle overwriting
                // semantics
                if (file.CopyToOutputDirectory != FileCopyMode.None)
                {
                    continue;
                }

                var props = new DeployProperties(file);
                if (props.ShouldDeploy)
                {
                    var dp = new DeployFile(file);
                    deployFiles.Add(dp);
                }
            }

            return(deployFiles);
        }
 string GetKey(DeployFile file)
 {
     return(file.SourceSolutionItem.Name + "," + file.TargetDirectoryID + "," + file.RelativeTargetPath);
 }