Visual Studio target framework not changing to 4.0 - c#

I am writing a Windows Forms program which doesn’t use any new tech from .net framework 4.5-4.7, but unfortunately I started the project with .net Framework set to 4.6.2. (Because in the beginning the company told me they only want to use it on win 7/8.1/10, later they changed their mind)
I know Windows XP is obsolete, but I have to run this program on a XP machine as well.
I already tried to set the targeting framework to .NET 4.0, but when I try on the XP machine with a .msi installer, it throws an error, that I cannot run a .net 4.6.2 dependent program, even before it starts the install process.
Can I “convert” the whole project to .net 4.0, or I have to copy all buttons, textboxes, couple thousands lines of code, etc. to a new project which only uses .net 4.0?
I’m using Visual Studio 2017.

Looking at the log you shared I can see DIRCA_CheckFX so I'm guessing the setup project is a vdproj which has been deprecated in favour of a framework like WiX.
The CheckFX step is a launch condition which you should be able to delete/manipulate, by opening the project and finding the launch conditions:
View -> Editor -> Launch conditions

Related

Is it possible to run a Visual Studio for Mac project on Windows?

Can a project made in Visual Studio for Mac be opened and run in Visual Studio on Windows?
I only have access to Mac, so unfortunately I cannot check it by myself.
It depends on the framework and libraries you target. Obviously if you use MonoMac or something with a Mac-specific UI, it'll run only on the Mac, but if you're writing a console app targeting .NET Core, by default it'll run fine on Windows. To write a cross-platform UI, you could try a third-party framework like Avalonia.
Edit: I should add that the .csproj and .sln formats used by Visual Studio for Mac are the same used by VS for Windows, so in general a project or solution for a cross-platform app (.NET Core) or library (.NET Core or .NET Standard) can be read by either Visual Studio.
In fact, I run Parallels with Windows 10 on my Mac with my repos in shared folders and will compile my cross-platform apps from whichever side on which I wish to run them. (There are line-ending considerations and other minor annoyances, but it works.)

C# WPF Program Relase not working on other computers

This may be a noobish question, but suppose I have a genereated exe from a program I ran in release mode on VS 2015, if I want to send my program to another computer, of course I send the Release folder (that has all of the appropriate DLLs + the main exe).. But does the user on the other computer have to have Visual Studios 2015 run my exe? If so, should I just make it so my program is actually installed on the other computer? It seems that when I send my exe to a computer that only has VS 2012 it doesn't want to run, but when I sent my exe to a computer with VS 2015 it will run.. Is this just coincidence perhaps?
If you've generated the .exe in VS 2015, it has probably compiled using .NET 4.5.1 or above. This will not be the case for VS 2012. You need to either: compile your program against an earlier version of the .NET framework, which you can do in the project's properties. Or, find out what version of the .NET framework you need, and make sure the client system has that .NET framework installed.
No, you don't need to have VS instaled on client computer, neither 2012 nor 2015. All you need to ensure is that the computer have the same NET framework as your project has. For instance, if you project use Framework 4.0, you sen the release folder content and if that computer has the framework installed it should work. You must also check App.Config for your connection string if you are using a database.

Visual Studio 2015 + Windows 10 Deployment

So I'm new in the Visual Studio 2015 (Community), I liked the C# + XAML set so I start learning from scratch (I'm a VB6,Php,Js Dev) and I found the following issues.
a) How do yo do a standalone installation or release of a simple application?. (When I build the release it says: this application can only run in the context of an app container).
b) By programming on this set (c# + XAML), can I build applications for WinXP,Win7,Win8? (I found that the only requirement is to have .NET 4 installed, and when creating the solution on vs2015 target that framework).
I'm used to the fact that I can build my app and it will run just by installing the dlls on the client machine.
Thanks in advance for any answer or directions to solve this questions.
It sounds as if you have created a Modern app project. That will only run on Win8 and later.
If you want to use C# along with XAML, you should re-create the project as a WPF Application. When you create a new project, you would just look under the "Windows" section. Do not select "Universal" or "Windows 8" unless you intend to build for newer systems. WPF projects can be run on WinXP and later. I believe WPF also has a minimum requirement of .NET 3.0.

Visual Studio 2013 Windows forms application not working on windows 7

Hi i am new to windows forms application development, I have developed an application on visual studio 2013 which is working fine on my system. Then i published it using visual studio 2013 publish option, now i am trying to run that application on other system which has windows 7 by installing it from the setup i get after publishing it. The application doesn't install and ask to download .net 4.5 framework.
How can i make an application that is compatible with windows 7 and windows xp also using visual studio 2013.
You can change target version , so that your application will run on Windows XP/7 .
To change the targeted version
In Solution Explorer, open the shortcut menu for the project that you want to change, and then choose Properties.
In the left column of the properties window, choose the Application tab.
In the Target Framework list, choose the version that you want.
In the verification dialog box that appears, choose the Yes button.
The project unloads. When it reloads, it targets the .NET Framework version that you just chose.
Note:
After you create a Windows Store app in Visual Studio 2013, you can't
change the targeted version of either Windows or the .NET Framework.
Also you may use multi targetting.
.Net framework 4.5 is not compatible with Win XP and previous releases of windows.You need to change the vesion of framework from your visual studio.It can be changed as follows:
File -> new project ->on the popped up window select .Net Framework 3.5 (or lesser) and create your desktop application.
One more thing is don't select "Maximize window" property for your form otherwise your form will get cropped when you run it on XP or Win7 etc.It is a general observation that I had.

Using visual studio for developing mono applications

How do I use Visual Studio to develop applications on Mono? Is this possible?
You just build the applications in Visual Studio, and run them under Mono instead of under .NET. The binaries should be compatible... but you'll need to make sure you don't use any libraries which aren't available in Mono - see the Mono Application Compatibility Guidelines.
(According to that page, you need to turn off incremental builds in Visual Studio though - a point I wasn't aware of before :)
See this article on how to run your apps while targeting the mono framework from VS.
Miguel has posted this entry a while ago, so it's quite dated. You can also try this and this (all hail Web Archive!)
Since version 2.0 MonoDevelop supports VisualStudio project/solutions file format. This means that you can use the same code base on Windows with VS and .Net and on Linux with MonoDevelop and Mono. That in my opinion is the best way to go about it. There are no major reasons to run application in Mono on Windows, other than for testing purposes and for that I'd rather set up a virtual machine to test the software in native environment.
I've posted an article on how to integrate Mono 2.8 (the build for .Net 4.0) into Visual Studio 2010 here - there's a link there to another profile built for Mono 2.4 (.Net 3.5) if that's what you're aiming for.
You can integrate the new Mono 2.8 profile with 3 simple steps:
Download the profile itself from here.
Unzip the contents of the profile Zip to one of the following directories:
32-bit systems: C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
64-bit systems: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile
The "Mono" folder in the ZIP should be directly under the "Profile" directory.
Restart Visual Studio if it had been running, open the properties of the project you want to use with Mono, and select the Mono Profile for 2.8:
Note: You will not be able to select the Mono Profile straight from the New Project dialog box; for some reason, that list of profiles doesn't match. Create your project as a .Net Framework 4.0 project first, and after creation set the project properties to Mono.
If you've upgraded your MonoDevelop install to the latest version (as of today, anyway), this Visual Studio solution & Project file will open with no problem - no changes required at all.
If you encounter the problem that you need .NETFramework,Version=v4.0,Profile=Mono in order to run the application, the trick was to create registry key.
For running Windows 7 x64, it was: HKEY\_LOCAL\_MACHINESOFTWAREWow6432NodeMicrosoft .NETFrameworkv4.0.30319SKUs .NETFramework,Version=v4.0,Profile=Mono
I suppose for x86 it’s HKEY\_LOCAL\_MACHINESOFTWAREMicrosoft.NETFramework v4.0.30319SKUs.NETFramework,Version=v4.0,Profile=Mono
(Where v4.0.30319 would be the version of the current 4.0 framework installed.)
Yes, you can develop on Visual Studio and target Mono (Mono for x86).
Here is an answer I made on all the available possible alternative to compile against Mono on Windows. However, it's focused for Mono x86.
As a summary, let's list the possible choice for VS development:
MonoHelper addin
Mono Profile
For Android/Ios, you can also cross-compile and debug inside Visual Studio with Xamarin addin. Although it's not free for commercial huge applications, there a free version available to make small ones.
Note: For those who wonder why in the world I would like to develop in Visual Studio on Windows, instead of MonoDevelop on Unix, let say that developer experience in MonoDevelop does not compare to VS one (especially when it comes to debugger/refactoring, the last due more to Resharper than to VS itself).

Categories