• 升级 DEVexpress控件 项目


    http://blog.csdn.net/zxkid/article/details/1967900

    编译DXperience 7.1源码和升级原有的应用程序

    一)升级DXperience控件

    1) 关闭VS2005,卸载老的控件版本
    通过控制面板的添加/删除程序功能进行卸载

    2) 安装试用版
    安装试用版是必须的,因为它包括源码包中所没有的帮助和各种工具。
    从DevExpress网站下载DXperience试用版,下载得到的文件名为:DXperienceEval-7.1.1.exe
    双击进行安装。

    3) 将压缩的源码文件DXperience-7.1.1-Sources.rar解压到试用版的安装目录的Sources子目录下
    DXperience 7.1默认的安装目录为:C:/Program Files/Developer Express .NET v7.1/
    所以源码包应解压到C:/Program Files/Developer Express .NET v7.1/Sources/目录
    解压完成后应看到Sources目录下多了十几个源码子目录

    4) 将三个安装脚本复制到安装目录的Sources子目录下并执行
    这三个安装脚本为:clear.bat, buildall.cmd, buildproject.cmd 均为DOS批处理文件
    从DevExpress官方网站可以下载到:
    https://www.devexpress.com/Support/Center/ViewKBIssue.aspx?kbid=A609

    具体内容如下:
    clear.bat

    @echo off

    set DXVER=v7.1
    SET GACPATH=C:WINDOWSassemblyGAC_MSIL

    del /q DevExpress.DLL*.dll
    del /q DevExpress.DLL*.pdb

    echo Clear GAC...
    rd //q %GACPATH%DevExpress.Data.%DXVER%
    rd //q %GACPATH%DevExpress.Utils.%DXVER%
    rd //q %GACPATH%DevExpress.Xpo.%DXVER%
    rd //q %GACPATH%DevExpress.Xpo.%DXVER%.Design
    rd //q %GACPATH%DevExpress.Xpo.%DXVER%.Providers
    rd //q %GACPATH%DevExpress.Xpo.%DXVER%.Compact
    rd //q %GACPATH%DevExpress.Xpo.%DXVER%.Linq
    rd //q %GACPATH%DevExpress.Data.%DXVER%.Compact
    rd //q %GACPATH%DevExpress.XtraBars.%DXVER%
    rd //q %GACPATH%DevExpress.XtraBars.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraCharts.%DXVER%
    rd //q %GACPATH%DevExpress.XtraCharts.%DXVER%.UI
    rd //q %GACPATH%DevExpress.XtraCharts.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraEditors.%DXVER%
    rd //q %GACPATH%DevExpress.XtraEditors.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraNavBar.%DXVER%
    rd //q %GACPATH%DevExpress.XtraNavBar.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraGrid.%DXVER%
    rd //q %GACPATH%DevExpress.XtraGrid.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraLayout.%DXVER%
    rd //q %GACPATH%DevExpress.XtraLayout.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraPrinting.%DXVER%
    rd //q %GACPATH%DevExpress.XtraPrinting.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraPivotGrid.%DXVER%
    rd //q %GACPATH%DevExpress.XtraPivotGrid.%DXVER%.Core
    rd //q %GACPATH%DevExpress.XtraPivotGrid.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraReports.%DXVER%
    rd //q %GACPATH%DevExpress.XtraReports.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraReports.%DXVER%.Import
    rd //q %GACPATH%DevExpress.XtraRichTextEdit.%DXVER%
    rd //q %GACPATH%DevExpress.XtraScheduler.%DXVER%
    rd //q %GACPATH%DevExpress.XtraScheduler.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraScheduler.%DXVER%.OutlookExchange
    rd //q %GACPATH%DevExpress.XtraScheduler.%DXVER%.VCalendarExchange
    rd //q %GACPATH%DevExpress.XtraSpellChecker.%DXVER%
    rd //q %GACPATH%DevExpress.XtraSpellChecker.%DXVER%.Core
    rd //q %GACPATH%DevExpress.XtraSpellChecker.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraTreeList.%DXVER%
    rd //q %GACPATH%DevExpress.XtraTreeList.%DXVER%.Design
    rd //q %GACPATH%DevExpress.XtraVerticalGrid.%DXVER%
    rd //q %GACPATH%DevExpress.XtraVerticalGrid.%DXVER%.Design
    rd //q %GACPATH%DevExpress.Tutorials.%DXVER%
    rd //q %GACPATH%DevExpress.BonusSkins.%DXVER%
    rd //q %GACPATH%DevExpress.OfficeSkins.%DXVER%

    rd //q %GACPATH%DevExpress.Web.%DXVER%
    rd //q %GACPATH%DevExpress.Web.ASPxDataControls.%DXVER%
    rd //q %GACPATH%DevExpress.Web.ASPxGrid.%DXVER%
    rd //q %GACPATH%DevExpress.Web.ASPxPivotGrid.%DXVER%

    buildproject.cmd

    if not exist %2 goto end

    echo Building %1...
    %gacutil% -u 
    %1,processorArchitecture=msil /silent
    %msbuild% 
    /nologo /t:Rebuild /verbosity:quiet /p:Configuration=%configuration% %2
    %gacutil% -i DevExpress
    .DLL%1.dll /silent
    echo Done %1
    :end

    buildall.cmd

    @echo off

    SET sn="C:Program FilesMicrosoft Visual Studio 8SDKv2.0Binsn.exe"
    set gacutil="C:Program FilesMicrosoft Visual Studio 8SDKv2.0Bingacutil.exe"
    set msbuild=c:windowsMicrosoft.NETFrameworkv2.0.50727MSBuild.exe
    set dxver=v7.1
    set configuration=Debug

    if exist DevExpress.KeyStrongKey.snk goto build
    echo Generating strong key
    %sn% -k DevExpress
    .KeyStrongKey.snk

    :build
    call buildproject.cmd DevExpress.Data.%dxver%.Compact ".DevExpress.DataDevExpress.Data.Compact.csproj"
    call buildproject.cmd DevExpress.Data.%dxver% ".DevExpress.DataDevExpress.Data.csproj"
    call buildproject.cmd DevExpress.Utils.%dxver% ".DevExpress.UtilsDevExpress.Utils.csproj"
    call buildproject.cmd DevExpress.BonusSkins.%dxver% ".DevExpress.BonusSkinsDevExpress.BonusSkins.csproj" 
    call buildproject.cmd DevExpress.OfficeSkins.%dxver% ".DevExpress.OfficeSkinsDevExpress.OfficeSkins.csproj" 
    call buildproject.cmd DevExpress.XtraEditors.%dxver% ".DevExpress.XtraEditorsDevExpress.XtraEditorsDevExpress.XtraEditors.csproj" 
    call buildproject.cmd DevExpress.XtraEditors.%dxver%.Design ".DevExpress.XtraEditorsDevExpress.XtraEditors.DesignDevExpress.XtraEditors.Design.csproj" 
    call buildproject.cmd DevExpress.XtraNavBar.%dxver% ".DevExpress.XtraNavBarDevExpress.XtraNavBarDevExpress.XtraNavBar.csproj" 
    call buildproject.cmd DevExpress.XtraNavBar.%dxver%.Design ".DevExpress.XtraNavBarDevExpress.XtraNavBar.DesignDevExpress.XtraNavBar.Design.csproj" 
    call buildproject.cmd DevExpress.XtraTreeList.%dxver% ".DevExpress.XtraTreeListDevExpress.XtraTreeListDevExpress.XtraTreeList.csproj" 
    call buildproject.cmd DevExpress.XtraTreeList.%dxver%.Design ".DevExpress.XtraTreeListDevExpress.XtraTreeList.DesignDevExpress.XtraTreeList.Design.csproj" 
    call buildproject.cmd DevExpress.Web.%dxver% ".DevExpress.WebDevExpress.Web.csproj"
    call buildproject.cmd DevExpress.Web.ASPxDataControls.%dxver% ".DevExpress.Web.ASPxDataControlsDevExpress.Web.ASPxDataControls.csproj"
    call buildproject.cmd DevExpress.Web.ASPxGrid.%dxver% ".DevExpress.Web.ASPxGridDevExpress.Web.ASPxGrid.csproj"
    call buildproject.cmd DevExpress.XtraPivotGrid.%dxver%.Core ".DevExpress.XtraPivotGridDevExpress.XtraPivotGrid.CoreDevExpress.XtraPivotGrid.Core.csproj" 
    call buildproject.cmd DevExpress.Web.ASPxPivotGrid.%dxver% ".DevExpress.Web.ASPxPivotGridDevExpress.Web.ASPxPivotGrid.csproj"
    call buildproject.cmd DevExpress.Xpo.%dxver% ".DevExpress.XpoDevExpress.XpoDevExpress.Xpo.csproj" 
    call buildproject.cmd DevExpress.Xpo.%dxver%.Compact ".DevExpress.XpoDevExpress.Xpo.CompactDevExpress.Xpo.Compact.csproj" 
    call buildproject.cmd DevExpress.Xpo.%dxver%.Design ".DevExpress.XpoDevExpress.Xpo.DesignDevExpress.Xpo.Design.csproj" 
    rem call buildproject.cmd DevExpress.Xpo.%dxver%.Providers ".DevExpress.XpoDevExpress.Xpo.ProvidersDevExpress.Xpo.Providers.csproj" 
    call buildproject.cmd DevExpress.XtraBars.%dxver% ".DevExpress.XtraBarsDevExpress.XtraBarsDevExpress.XtraBars.csproj" 
    call buildproject.cmd DevExpress.XtraBars.%dxver%.Design ".DevExpress.XtraBarsDevExpress.XtraBars.DesignDevExpress.XtraBars.Design.csproj" 
    call buildproject.cmd DevExpress.XtraCharts.%dxver% ".DevExpress.XtraChartsDevExpress.XtraChartsDevExpress.XtraCharts.csproj" 
    call buildproject.cmd DevExpress.XtraCharts.%dxver%.UI ".DevExpress.XtraChartsDevExpress.XtraCharts.UIDevExpress.XtraCharts.UI.csproj" 
    call buildproject.cmd DevExpress.XtraCharts.%dxver%.Design ".DevExpress.XtraChartsDevExpress.XtraCharts.DesignDevExpress.XtraCharts.Design.csproj" 
    call buildproject.cmd DevExpress.XtraGrid.%dxver% ".DevExpress.XtraGridDevExpress.XtraGridDevExpress.XtraGrid.csproj" 
    call buildproject.cmd DevExpress.XtraGrid.%dxver%.Design ".DevExpress.XtraGridDevExpress.XtraGrid.DesignDevExpress.XtraGrid.Design.csproj" 
    call buildproject.cmd DevExpress.XtraLayout.%dxver% ".DevExpress.XtraLayoutDevExpress.XtraLayoutDevExpress.XtraLayout.csproj" 
    call buildproject.cmd DevExpress.XtraLayout.%dxver%.Design ".DevExpress.XtraLayoutDevExpress.XtraLayout.DesignDevExpress.XtraLayout.Design.csproj" 
    call buildproject.cmd DevExpress.XtraPrinting.%dxver% ".DevExpress.XtraPrintingDevExpress.XtraPrintingDevExpress.XtraPrinting.csproj" 
    call buildproject.cmd DevExpress.XtraPrinting.%dxver%.Design ".DevExpress.XtraPrintingDevExpress.XtraPrinting.DesignDevExpress.XtraPrinting.Design.csproj" 
    call buildproject.cmd DevExpress.XtraPivotGrid.%dxver% ".DevExpress.XtraPivotGridDevExpress.XtraPivotGridDevExpress.XtraPivotGrid.csproj" 
    call buildproject.cmd DevExpress.XtraPivotGrid.%dxver%.Design ".DevExpress.XtraPivotGridDevExpress.XtraPivotGrid.DesignDevExpress.XtraPivotGrid.Design.csproj" 
    call buildproject.cmd DevExpress.XtraRichTextEdit.%dxver% ".DevExpress.XtraRichTextEditDevExpress.XtraRichTextEditDevExpress.XtraRichTextEdit.csproj" 
    call buildproject.cmd DevExpress.XtraReports.%dxver% ".DevExpress.XtraReportsDevExpress.XtraReportsDevExpress.XtraReports.csproj" 
    call buildproject.cmd DevExpress.XtraReports.%dxver%.Design ".DevExpress.XtraReportsDevExpress.XtraReports.DesignDevExpress.XtraReports.Design.csproj" 
    call buildproject.cmd DevExpress.XtraScheduler.%dxver% ".DevExpress.XtraSchedulerDevExpress.XtraSchedulerDevExpress.XtraScheduler.csproj" 
    call buildproject.cmd DevExpress.XtraScheduler.%dxver%.Design ".DevExpress.XtraSchedulerDevExpress.XtraScheduler.DesignDevExpress.XtraScheduler.Design.csproj" 
    call buildproject.cmd DevExpress.XtraScheduler.%dxver%.OutlookExchange ".DevExpress.XtraSchedulerDevExpress.XtraScheduler.OutlookExchangeDevExpress.XtraScheduler.OutlookExchange.csproj"
    call buildproject.cmd DevExpress.XtraScheduler.%dxver%.VCalendarExchange ".DevExpress.XtraSchedulerDevExpress.XtraScheduler.VCalendarExchangeDevExpress.XtraScheduler.VCalendarExchange.csproj"
    call buildproject.cmd DevExpress.XtraSpellChecker.%dxver%.Core ".DevExpress.XtraSpellCheckerDevExpress.XtraSpellChecker.CoreDevExpress.XtraSpellChecker.Core.csproj"
    call buildproject.cmd DevExpress.XtraSpellChecker.%dxver% ".DevExpress.XtraSpellCheckerDevExpress.XtraSpellCheckerDevExpress.XtraSpellChecker.csproj" 
    call buildproject.cmd DevExpress.XtraSpellChecker.%dxver%.Design ".DevExpress.XtraSpellCheckerDevExpress.XtraSpellChecker.DesignDevExpress.XtraSpellChecker.Design.csproj" 
    call buildproject.cmd DevExpress.XtraVerticalGrid.%dxver% ".DevExpress.XtraVerticalGridDevExpress.XtraVerticalGridDevExpress.XtraVerticalGrid.csproj" 
    call buildproject.cmd DevExpress.XtraVerticalGrid.%dxver%.Design ".DevExpress.XtraVerticalGridDevExpress.XtraVerticalGrid.DesignDevExpress.XtraVerticalGrid.Design.csproj" 
    call buildproject.cmd DevExpress.Tutorials.%dxver% ".DevExpress.TutorialsDevExpress.Tutorials.csproj"

    echo -------------------------------
    echo All done
    pause

    5) 先执行clear.bat删除试用版的DLL,再执行buildall.cmd重新生成正式版的DLL
    编译时可能会显示一些黄色的警告(warning),不用担心,不会出现错误(error)的

    6) 执行 开始 -> 所有程序 -> Developer Express .NET v7.1 -> Tools -> ToolboxCreator
    以删除试用版的VS2005工具箱选项卡,并重新生成正式版的VS2005工具箱选项卡

    7) 到此控件已经升级完成,让我们确认一下
    打开VS2005,新建一个Windows应用程序,然后按Ctrl+Alt+X显示工具箱,发现有四个新选项卡:
    Developer Express: WinScheduler.v7.1
    Developer Express: WinLib.v7.1,
    Developer Express: Win.v7.1
    Developer Express: General.v7.1

    展开Developer Express: Win.v7.1选项卡,将GridControl拖到Form1上,然后对GridControl点右键,
    在弹出的快捷菜单中,选择“About”,这时可以看到XtraGrid的版本号为7.1.1,
    Serial Number显示为--TRIAL VERSION--,虽然显示为试用版但其实已经是正式版了
    真正的试用版只要把GridControl拖到Form上就会自动弹出关于对话框的


    二)升级原有的应用程序

    1) 关闭VS2005,备份要升级的应用程序
    比如说用WinRAR打个备份包

    2) 通过DevExpress提供的ProjectConverter进行升级
    执行 开始 -> 所有程序 -> Developer Express .NET v7.1 -> Tools -> ProjectConverter
    在弹出的对话框中选择VS项目文件所在的路径并去掉创建备份文件的勾然后按Upgrade就行了
    ProjectConverter会将项目中所有对老版本DXperience的引用转换为新版本

    3) 打开VS2005,重新编译项目
    根据原来DXperience控件版本的不同,可能需要更改一些代码
    我从DevExpress Windows Controls 3.2.5(2005)基础上升级的,有三个地方需要改:
    GridView.ExportToExcel -> GridView.ExportToXls
    GridView.OptionsView.ShowFilterPanel = false -> GridView.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.Never
    GridView.OptionsView.ShowFilterPanel = true -> GridView.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.ShowAlways
    GridView.OptionsBehavior.ShowEditorOnMouseUp = true -> GridView.OptionsBehavior.EditorShowMode = EditorShowMode.MouseUp
    可以按Ctrl+H激活查找和替换对话框,对当前项目所有cs文件进行替换
    再次编译项目顺利通过

    4) 代码没问题了,但是界面还需要改动
    应用程序运行后发现界面变得不像样子了
    控件和工具栏的背景色不对了,按钮上的图片变成了不透明的了
    在解决方案资源管理器中打开Program.cs,在Main()函数的Application.Run(new Forms.FormMain());这行代码前输入下面的代码

                #region 设置DevExpress控件的默认样式
                UserLookAndFeel defaultLookAndFeel 
    = UserLookAndFeel.Default;
                defaultLookAndFeel.UseWindowsXPTheme 
    = false;
                defaultLookAndFeel.Style 
    = LookAndFeelStyle.Office2003;
                
    #endregion

    这段代码的功能是统一设置DevExpress控件的默认样式

    在解决方案资源管理器中打开Properties目录的Resources.Resx下面的Resources.Designer.cs
    将所有强图像资源属性的Set方法的return (System.Drawing.Bitmap)(object);改为下面三句:

                    Bitmap bitmap = (Bitmap)obj;
                    bitmap.MakeTransparent(Color.Black);
                    
    return bitmap;

    注意:第二句代码,如果你使用的是32位色bitmap,TransparentColor为Color.Black,如果是24位色的话,TransparentColor为Color.Fuchsia
    这样做的目的时,在强类型图像资源加载时就将其设为透明

    这样改动之后,界面看起来跟原来差不多了

    5) 更改ClickOnce布署
    最后,还需要对ClickOnce布署进行一些调整
    点击 项目菜单 -> 属性... 启动项目属性画面,选择“发布”选项卡并点击“应用程序文件(i)...”按钮
    在弹出画面中选中显示所有文件,将老的DevExpress控件DLL从中删除,并将新的DevExpress控件DLL的发布状态改为“包括”
    点击“立即发布”按钮进行发布,从客户端更新后测试,顺利通过

    如果你是采用的安装程序,也只要替代DevExpress控件DLL就行了

    6) 最后大功告成,可以举杯庆祝了。嘿嘿! 

  • 相关阅读:
    ThinkPHP
    ThinkPHP
    静态化
    静态化
    静态化
    设计模式
    sublime
    静态化
    OPTIMIZE TABLE 小解
    information_schema系列八(事物,锁)
  • 原文地址:https://www.cnblogs.com/daidaigua/p/2482584.html
Copyright © 2020-2023  润新知