System.Web assembly is not found on .net 4.0 version
Asked Answered
E

4

11

I updated .NET from 3.5 to 4.0 version, but after updating the assembly System.Web doesn't work any more.

I'm getting the following error:

Warning 1 Could not resolve assembly "System.Web". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

Using the 3.5 version it works fine. How can I fix this?

Enciso answered 8/10, 2011 at 2:21 Comment(1)
Target the full version, not the client version.Afrikaans
B
19

Change the project from ClientProfile to full .NET 4.0

The .NET Framework 4 Client Profile is a subset of the .NET Framework 4 that is optimized for client applications. It provides functionality for most client applications, including Windows Presentation Foundation (WPF), Windows Forms, Windows Communication Foundation (WCF), and ClickOnce features. This enables faster deployment and a smaller install package for applications that target the .NET Framework 4 Client Profile.

See Differences between Microsoft .NET 4.0 full Framework and Client Profile

Bakken answered 8/10, 2011 at 2:25 Comment(0)
P
15

I think you have .NET 4.0 Client profile selected for target framework. Just switch to .Net 4.0

enter image description here

Plutonian answered 8/10, 2011 at 2:24 Comment(0)
C
5

You're targetting the .net 4.0 Client Profile, which is a .net "lite" for desktop users. Switch to full .net 4.0 to get at System.Web

Project Properties -> Application tab -> Target Framework

Capel answered 8/10, 2011 at 2:25 Comment(0)
B
4

Try changing the "Target Framework" to be ".NET Framework 4" instead of ".NET Framework 4 Client Profile".

Beeler answered 8/10, 2011 at 2:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.