简体   繁体   中英

Visual Studio 2013 - Targeting .net 2

I have built a very small windows forms application for a client which simply formats a csv file to a different spec.

However, one of the users is on a very old machine, and is getting the following error when installing:

Prerequisite check for system component Microsoft .NET Framework 4.5 (x86 and x64) failed

So I thought I would change the target framework of my app and build a version on .net 2.0:

I can't post the image as I don't have a reputation???, but it shows that my target framework is 2.0 and also:

<supportedRuntime version="v2.0.50727"/>

is set in app.config

However, building and publishing still results in the same installation error, which makes me think that having created the app as .net 4.5 targeted it has incompatible code embedded somewhere causing the reliance on 4.5 still?

So I thought I would create a new app and target 2.0, however http://msdn.microsoft.com/en-us/library/bb398202.aspx says:

In the list at the top of the New Project dialog box, choose the version of the .NET Framework that you want your project to target.

However, my version of visual studio 2013 does not have this option.

So finally my question is, how can I get my application to run on an old version of .net (2.0) in vs2013, or will I have to download an older version of visual studio?

I completely forgot about this question, and having just received a badge for 1000 views it seems I should update.

As Matt states in his comment, no version of .Net is guaranteed to be installed on XP, plus the fact that Windows XP does not support 4.5 meant I needed to change my framework and then ensure the version I had chosen was available on the machine installing my application.

.Net compatibility chart: http://msdn.microsoft.com/en-us/library/bb822049(v=vs.110).aspx

Once I had switched to .Net 4.0 I then enabled auto-distribution of the framework for machines installing my application. Microsoft provide a full breakdown of how this works here: http://support.microsoft.com/kb/324733

This simply ensures the correct frameworks are installed along with your application (if they are not currently available).

Once I had done this the correct framework was installed alongside my application on that particular PC and the application then ran correctly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM