Beispiel #1
0
        protected override void OnExecute()
        {
            //RootNamespace Title Product OutputFileName
            //var friendlyName = "antDomain";
            //var assembly = Assembly.GetExecutingAssembly();
            //var codeBase = assembly.Location;
            //var codeBaseDirectory = Path.GetDirectoryName(codeBase);
            //var setup = new AppDomainSetup()
            //{
            //    ApplicationName = "AntDeployApplication",
            //    ApplicationBase = codeBaseDirectory,
            //    DynamicBase = codeBaseDirectory,
            //};
            //setup.CachePath = setup.ApplicationBase;
            //setup.ShadowCopyFiles = "true";
            //setup.ShadowCopyDirectories = setup.ApplicationBase;
            //AppDomain.CurrentDomain.SetShadowCopyFiles();
            //SecurityZone zone = SecurityZone.MyComputer;
            //Evidence baseEvidence = AppDomain.CurrentDomain.Evidence;
            //Evidence evidence = new Evidence(baseEvidence);
            //string assemblyName = Assembly.GetExecutingAssembly().FullName;
            //evidence.AddAssembly(assemblyName);
            //evidence.AddHost(new Zone(zone));

            //AppDomain otherDomain = AppDomain.CreateDomain(friendlyName,evidence, setup);

            try
            {
                EditProjectPackage.DTE.Documents.SaveAll();
                Saveall();

                ProjectParam param = new ProjectParam();
                param.IsWebProejct     = ProjectHelper.IsWebProject(_project);
                param.IsNetcorePorject = ProjectHelper.IsDotNetCoreProject(_project);
                param.OutPutName       = _project.GetProjectProperty("OutputFileName");
                param.VsVersion        = ProjectHelper.GetVsVersion();
                param.MsBuildPath      = ProjectHelper.GetMsBuildPath();
                param.ProjectPath      = _projectFile;
                if (!string.IsNullOrEmpty(param.MsBuildPath))
                {
                    param.MsBuildPath = Path.Combine(param.MsBuildPath, "MSBuild.exe");
                }

                DoAntDeployProcess(_projectFile, param);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                //AppDomain.Unload(otherDomain);
            }
        }