Questions tagged [.net-4.0]

Version 4.0 of the .NET Framework. Use for questions specifically related to .NET Framework 4.0. For questions on .NET Framework generally, use the .net tag.

Released on April 12th, 2010, version 4.0 (4.0.30319.1) of the Microsoft .NET Framework contains numerous enhancements, new features and bug fixes.

What's New in the .NET Framework 4

Language Improvements

Base Class Library (BCL) additions:

For more information about the new features, see:

8760 questions
608
votes
10 answers

What are the true benefits of ExpandoObject?

The ExpandoObject class being added to .NET 4 allows you to arbitrarily set properties onto an object at runtime. Are there any advantages to this over using a Dictionary, or really even a Hashtable? As far as I can tell, this is…
Reed Copsey
  • 522,342
  • 70
  • 1,092
  • 1,340
559
votes
14 answers

App.Config Transformation for projects which are not Web Projects in Visual Studio?

For Visual Studio 2010 Web based application we have Config Transformation features by which we can maintain multiple configuration files for different environments. But the same feature is not available for App.Config files for Windows…
Amitabh
  • 51,891
  • 40
  • 102
  • 154
536
votes
17 answers

What 'additional configuration' is necessary to reference a .NET 2.0 mixed mode assembly in a .NET 4.0 project?

I have a project in which I'd like to use some of the .NET 4.0 features but a core requirement is that I can use the System.Data.SQLite framework which is compiled against 2.X. I see mention of this being possible such as the accepted answer here…
jamone
  • 16,809
  • 17
  • 58
  • 90
429
votes
21 answers

Microsoft.WebApplication.targets was not found, on the build server. What's your solution?

Trying to build my project on the build server gives me the following error: Microsoft (R) Build Engine Version 4.0.30319.1 error MSB4019: The imported project "C:\Program Files…
stacker
  • 13,651
  • 17
  • 43
  • 73
415
votes
12 answers

An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode

I Installed DotNetOpenAuth SDK-3.4.5.10201.vsix and I can't get it working. It works locally (when I run as localhost) but when i try to publish it ain't working. The IIS error message I get is Error Summary HTTP Error 500.22 - Internal…
Mikael
  • 5,199
  • 4
  • 25
  • 37
360
votes
4 answers

Differences between Microsoft .NET 4.0 full Framework and Client Profile

The Microsoft .NET Framework 4.0 full installer (32- and 64-bit) is 48.1 MB and the Client Profile installer is 41.0 MB. The extracted installation files are 237 MB and 194 MB respectively, and once installed, they are 537 MB and 427 MB. This is a…
Click Ok
  • 8,402
  • 16
  • 66
  • 98
338
votes
28 answers

ASP.NET MVC on IIS 7.5

I'm running Windows 7 Ultimate (64 bit) using Visual Studio 2010 RC. I recently decided to have VS run/debug my apps on IIS rather than the dev server that comes with it. However, every time I try to run an MVC app, I get the following error: HTTP…
Omar
  • 37,391
  • 42
  • 132
  • 207
331
votes
9 answers

How to easily initialize a list of Tuples?

I love tuples. They allow you to quickly group relevant information together without having to write a struct or class for it. This is very useful while refactoring very localized code. Initializing a list of them however seems a bit redundant. var…
Steven Jeuris
  • 15,774
  • 7
  • 61
  • 137
302
votes
3 answers

.NET 4.0 has a new GAC, why?

%windir%\Microsoft.NET\assembly\ is the new GAC. Does it mean now we have to manage two GACs, one for .NET 2.0-3.5 applications and the other for .NET 4.0 applications? The question is, why?
Max Toro
  • 27,264
  • 10
  • 71
  • 109
270
votes
27 answers

Why am I getting 'Assembly '*.dll' must be strong signed in order to be marked as a prerequisite.'?

I'm trying to compile my excel addin using C# 4.0, and started to get this problem when building my project in Visual Studio. It's important to tell you that I haven't had this problem before. What could cause this to happen?
Sergey Kucher
  • 4,070
  • 5
  • 26
  • 47
237
votes
11 answers

How can I run PowerShell with the .NET 4 runtime?

I am updating a PowerShell script that manages some .NET assemblies. The script was written for assemblies built against .NET 2 (the same version of the framework that PowerShell runs with), but now needs to work with .NET 4 assemblies as well as…
Emperor XLII
  • 12,143
  • 11
  • 64
  • 70
230
votes
4 answers

Cancellation token in Task constructor: why?

Certain System.Threading.Tasks.Task constructors take a CancellationToken as a parameter: CancellationTokenSource source = new CancellationTokenSource(); Task t = new Task (/* method */, source.Token); What baffles me about this is that there is no…
Colin
  • 2,693
  • 3
  • 17
  • 14
217
votes
2 answers

What does 'useLegacyV2RuntimeActivationPolicy' do in the .NET 4 config?

While converting a project that used SlimDX, and therefore has unmanaged code, to .NET 4.0 I ran into the following error: Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without…
Cameron MacFarland
  • 65,569
  • 20
  • 98
  • 130
214
votes
10 answers

When should TaskCompletionSource be used?

AFAIK, all it knows is that at some point, its SetResult or SetException method is being called to complete the Task exposed through its Task property. In other words, it acts as the producer for a Task and its completion. I saw here the…
Royi Namir
  • 131,490
  • 121
  • 408
  • 714
207
votes
4 answers

What is the best way to implement a "timer"?

What is the best way to implement a timer? A code sample would be great! For this question, "best" is defined as most reliable (least number of misfires) and precise. If I specify an interval of 15 seconds, I want the target method invoked every 15…
Robert
  • 2,455
  • 3
  • 14
  • 15
1
2 3
99 100