.net-4.0

Separate long numbers by 3 digits

Is there a easy way to transform 1000000 in 1.000.000? A regex or string format in asp.net, c# ...

Can I write for .Net 4 using VS2008?

Can I write code against .Net 4 and its libraries using VS2008? If so how should I configure it? I realise that VS2008 will probably struggle with language changes such as the dynamic keyword but can I install the version 4 and target it anyway? My only real interest is in being able to use some of the new libraries, in particular I'm i...

Solving Combinatory Problems with LINQ /.NET4

I saw this article pop-up in my MSDN RSS feed, and after reading through it, and the sourced article here I began to wonder about the solution. The rules are simple: Find a number consisting of 9 digits in which each of the digits from 1 to 9 appears only once. This number must also satisfy these divisibility requirements: The numbe...

Entity Framework 4 and persisting foreign key relationships

I am a pretty much a newbie to Entity Framework (specifically version 4) and I am trying to understand an issue I have. I have an ASP.NET MVC2 project I am using with Entity Framework 4 and a Repository class. I have a simple foreign key relationship that I have defined. When I run my MVC project I am able to load the MVC form and updat...

Hosting Workflows with WorkflowServiceHost

Ok, so I may be approaching this incorrectly but essentially I'm trying to play with new WF services in 4.0 to build up to a Windows service that hosts a WF service. At the moment I have constructed client (containing a simple Activity XAML) and service (WF service implemented in a XAMLX file) projects. I have tried simple "hello worlds...

Help with entity frame work error. Error 0194: All artifacts loaded....

This is a c#/asp.net project. The full error message I get is:Error 0194: All artifacts loaded into the item collection must have the same version. Multiple versions were encountered. This project was started as a 3.5 and upgraded to 4.0. When I try to test any of the methods I get the error that I posted in the subject line. I am go...

Entity Framework insert error ("The Version field is required.")

I am using Silverlight 4 and RIA services. When I try to insert into my database, I get the following error: "Submit operation failed validation. Please inspect Entity.ValidationErrors for each entity in EntitiesInError for more information." Upon inspecting the ValidationErrors, I see: "The Version field is required." Isn't...

Upgrading VSTO project to .net 4 - What references do I actually need?

I'm developing an application for Office. It originally targeted .net 3.5, but I decided to upgrade to .net 4 because of some WPF issues that I've run into. When I switched all the projects in my solution and rebuilt, I got an error saying to include System.Xaml. I did that and rebuilt, and VS2010 told me to include another referenc...

How to use the InvokeMethod activity to add a string to a generic list using Workflow Foundation 4

I have a Workflow Foundation 4 activity that has a InvokeMethod that is configured to call the Add method on an instance of type IList(Of String), providing a parameter of type String. Running it gives me this error though: 'IList`1' does not have a public instance method named 'Add' matching the parameter types, generic type arguments...

.NET Framework 4 in WPF not showing bitmap effect

I am having a problem using VS2010 and framework version 4 with bitmap effects. If I have the code below and run it in a WPF application using the .NET Framework 4 Client Profile, the bitmap effect does not appear. If I set the framework version to .NET Framework 3.5 Client Profile (and change no code), it runs as expected. At first, I t...

Running .net 4 tests on remote files

Can anyone explain this one to me, as Ive got a not ideal solution Have a project in VS 2008 with MS unit tests in Import the project to VS 2010 Store files in My documents folder which is redirected to a server over the LAN Try to run tests, but no tests are found, and it comes up with a message no test are run as tests are disabled W...

Are .NET 4.0 Runtime slower than .NET 2.0 Runtime?

After I upgraded my projects to .NET 4.0 (With VS2010) I realized than they run slower than they were in .NET 2.0 (VS2008). So i decided to benchmark a simple console application in both VS2008 & VS2010 with various Target Frameworks: using System; using System.Diagnostics; using System.Reflection; namespace RuntimePerfTest { class...

Resolving MSBuild 4.0 warnings

I've upgraded a solution to use MSBuild 4.0. It compiles but I get lots of warnings, for example: "T:\projects\Castle.Core\buildscripts\Build.proj" (Package target) (1) -> "T:\projects\Castle.Core\Castle.Core-vs2008.sln" (Build target) (2:2) -> "T:\projects\Castle.Core\src\Castle.DynamicProxy.Tests\Castle.DynamicProxy.Tests-vs2008.cspr...

How do I use Console.CancelKeyPress in .NET 4? (Works fine in .NET 3.5 and below)

I am writing a Console app in C# 4 and want to gracefully cancel my program and Ctrl + C is pressed. The following code I have used many times before, but now when trying to use it in .NET 4, it seems a strange unhandled exception is occurring. namespace ConsoleTest { class Program { private static bool stop = false; ...

Workflow Service host not publishing Metadata.

Still hacking away with extreme persistence at WF services hosted outside of IIS. I'm now having issues with my WF service publishing metadata. Can someone take a look at my code and see what step I'm missing? The few tutorials that I've stumbled across for my scenario make it look so easy, and I know it is. I'm just missing something ri...

Exposing C# COM server events to Delphi client applications

My question is very similar to these two: http://stackoverflow.com/questions/1140984/c-component-events http://stackoverflow.com/questions/1638372/c-writing-a-com-server-events-not-firing-on-client However, what worked for them is not working for me. The type library file, does not have any hints of events definitions, so Delphi doesn...

Using the Client Profile, is it possible to reference an assembly that references System.Web?

I'm creating a small application that requires an assembly that also requires the System.Web assembly. The classes I am using from the referenced assembly do not require System.Web. I would like the application to target the 4.0 client profile, which means System.Web is not available. Is it possible to convince Visual Studio to refere...

Possible to implement an IsViewPortVisible dependencyproperty for an item in an ItemsControl?

I need to enable/disable spell checking in a richtextbox in an ItemsControl, based on whether the RichTextBox is visible in the ItemsControl's Scrollviewer. I think the route is to implement an IsViewPortVisible dependency property and wire an event handler for a changed event... I found this article that describes the lengthy process ...

Entity Framework 4 Hiding Underlying Resolver Tables when model is generated from database

When creating an entity framework model from scratch it is possible to specify a Many to Many relationship in the model. e.g Entity1 * ----- * Entity2 When a database is then generated from this, a resolver table is then created automatically between the two entities, this is hidden in the code model, allowing direct access to each of...

Code coverage tools that can be used on .NET 4.0 assemblies

We use Xunit.net as our unit test framework for use on our .NET4 assemblies. We have it integrated into our TFS 2010 team builds quite successfully. I now want to add code coverage to the nightly builds as well. Does anyone have a list of coverage tools that work on 4.0 assemblies and could be integrated into our automated builds? ...