Click here to Skip to main content
15,906,455 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hi.
I create a project and setup on a machine that has .net framework 3.5.
But i select target platform as .Net 2.0 and build the setup.

now on target machine .Net 2.0 is installed so my application install on the machine but when i try to run it, it throw the exception
VB
Message: Could not load file or assembly 'PresentationFramework, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file
specified.

Its Urgent.. Please Help.
Posted
Updated 27-Nov-11 7:07am
v2

That's because your application is compiled with .Net 3.5. Presentation framework is a WPF namespace, and that means the machine has to have .net 3.5 to run it. Yes, your setup project will run on a machine with 2.0 on it, but the app will not.

Just configure the setup app to install 3.5 as a prerequisite, and you'll be gold.
 
Share this answer
 
Comments
lavikgupta 28-Nov-11 1:54am    
But My project is simple Windows Form.. I didn't include anything from wpf
In Project Properties, there is an option: "Target platform". Select v.2.0.

The compilation will be successful if you are not using new features of the .NET introduced after .NET Framework v.2.0.

[EDIT]
Thanks to the note by Philippe below, I noticed that this is exactly the case, as you try to use WPF. There is no WPF in v.2.0, so one can only use WPF with .NET Framework 3.0 or later. That said, WPF cannot be used in Windows 2000, it needs XP or later version of Windows. If the Windows version is XP or later, there is no need to use .NET Framework 2.0. Anyone can install v.3.5 or 4.0, which I would recommend to anyone who uses XP or later version of Windows. Redistributable .NET Framework can also be easily deployed with the application.
[END EDIT]

At the same time, you can keep using C# v.3 in your source code. The compiled assemblies will work with .NET Framework v.2.0.

—SA
 
Share this answer
 
v2
Comments
Philippe Mori 27-Nov-11 17:14pm    
True, but as observed in solution 1, it look like the OP is using WPF...
Sergey Alexandrovich Kryukov 27-Nov-11 17:23pm    
Thank you very much for the note. I almost answered, so I'll add a fix.
--SA
lavikgupta 30-Nov-11 9:07am    
But My project is simple Windows Form.. I didn't use anything from wpf

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900