I use DevExpress in some of my projects. Each time there is an update to the devexpress libraries, they get copied to the clients computers when I update the software. Unfortunately this leads to losts of old versions of devexpress libraries on the client’s computers.

I'm planning to create a procedure that checks for old devexpress library versions and deletes them.

Devexpress files are like:

Devexpress.Data.v12.2.dll
Devexpress.Printing.v12.2.Core.dll
Devexpress.Utils.v12.2.dll
Devexpress.XtraEditors.v12.2.dll
Devexpress.XtraPrinting.v12.2.dll
Devexpress.XtraReports.v12.2.dll
Devexpress.Data.v12.0.dll
Devexpress.Printing.v12.0.Core.dll
Devexpress.Utils.v12.0.dll
Devexpress.XtraEditors.v12.0.dll
Devexpress.XtraPrinting.v12.0.dll
Devexpress.XtraReports.v12.0.dll

can anyone help me on how to achieve this?

Recommended Answers

All 3 Replies

Hi momerath thank you.

I start already coding however i can't get what i want it to delete old version file.

This is my code:

var dvxpressFiles = Directory.GetFiles(Application.StartupPath, "*.dll");

                foreach (string currentFile in dvxpressFiles)
                {
                    string fileName = currentFile.Substring((Application.StartupPath + "DevExpress.").Length + 1);

                    MessageBox.Show(fileName);
                }

I already get this result

Data.v12.2.dll
Data.v12.0.dll
Printing.v12.2.Core.dll
Printing.v12.0.Core.dll

I want to delete older version this file: Data.v12.0.dll & Printing.v12.0.Core.dll

You could bring back only files that don't match your current version.

String currentVersion = "v12.2";
var dvxpressFiles = Directory.GetFiles(Application.StartupPath, "*.dll")
                             .Where(fileName => !fileName.Contains(currentVersion))
                             .ToList();

This will return every dll file that does not contain the string "v12.2". You may want to adjust your search string to bring back only those that do have the "vxx.x" by changing your search string to "*.v??.?.dll But you need to make sure your version number pattern matches. Otherwise, it might be better to go with regex (of which I'm no expert)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.