How to make generated EXE work in all versions of .NET Framework?

I am very new to the .NET world, I have a small console project (very small) that basically just refers to the .DLL created in delphi (where most of the important code is), on my C # code, which I have cycles, sleep shutdown instructions, etc.

My clients use Microsoft Windows XP SP2, Microsoft XP SP3, Microsoft Windows Vista, and Microsoft 7. I want to create .EXE so that it works in all of these environments. In my development environment with C # 2010, I have the .NET framework 4.0, but I think some desktop computers have my client frames 3.5 and possibly older. Based on this situation, what is the best option for creating the most portable EXE among new and old versions of .NET?

A detailed answer is very welcome as I begin.

Since this may be my simple code, I insert it here.

using System; using System.Reflection; using System.Threading; using System.Web; using System.Diagnostics; using Redemption; namespace test{ class Program { static void Main(string[] args) { RedemptionLoader.DllLocation64Bit = @"redemption64.dll"; RedemptionLoader.DllLocation32Bit = @"redemption.dll"; var ToEmailAddress = args[0]; var subject = args[1]; var pathFileAttach = args[2]; SendMail(ToEmailAddress, subject, pathFileAttach); } private static void SendMail(string ToMail,string subject,string filePath) { var session = new RDOSession(); try { session.Logon(); if (session.LoggedOn) { var Drafts = session.GetDefaultFolder(rdoDefaultFolders.olFolderDrafts); RDOMail msg = Drafts.Items.Add("IPM.Note"); var body = "Test Redemption."; msg.To = ToMail; msg.Recipients.ResolveAll(); msg.Subject = subject; msg.Body = body; msg.Attachments.Add(filePath); msg.Save(); msg.Send(); System.Threading.Thread.Sleep(5000); } } finally { session.Logoff(); session = null; } } } } 
+4
source share
6 answers

Design and build against .net 2.0 as a Target Framework, and it will be compatible with all versions in the future.

+6
source

From the project menu, you can select the version of .net that you want to use (use 2.0, as Chris said). However, be careful, because sometimes this may require some adjustment.

See here for a list of changes that may be important to you.

It is also worth noting that, within the framework of the properties of your project, you can choose which dependencies are necessary to run your application. It will test and allow the user to obtain these dependencies, such as a specific version of the framework, before allowing the installation to progress.

+2
source

Remember that v1.0 and 1.1.NET Framework are extremely difficult to ensure compatibility. Although the entire version of the .NET Framework is technically backward compatible, 1.0 / 1.1 is at first very simple (they don’t even have common types), and secondly, there was some data about the language and implementation that changed significantly with the release of version v2.0, which actually may not be compatible with the framework after 2.0. Microsoft highly recommended everyone to .NET 1.1. programs are recompiled to target 2.0.

+1
source

While targeting version 2.0 for the platform is probably a good idea in this case, since you have a fairly simple application, you should also create an installer that will determine which version of the .NET client is installed and installed correct if required.

There are various ways to do this, but ClickOnce is part of Visual Studio and is very easy to set up. It does not create a large exe installation because it downloads the required .NET version from Microsoft when it starts.

0
source

The lower the Framework you build with, the more portable your application will be. Which structure you can build against depends on what you use in your code. As someone else pointed out, keep in mind that some of these operating systems will still require the installation of the .NET Framework as it is not included.

0
source

.NET 2.0 usually considers the structure that will be used when you want to be universal. Most sample code is written in version 2.0. However, you need to understand that you should not assume that .Net will be installed by default. Some old cars will have to install it. Very few will have at least 2.0 by now, but this is not an assumption that I would have made if you did not want to risk that people could not install your software and did not know why. By default, Windows XP does not ship with .NET.

0
source

All Articles