views:

691

answers:

3

Currently developing an ASP.NET WebApplication with VS2008. I stopped development for a few weeks, and when I came back, my project is exhibiting the following problem:

The whole project compiles fine (all targeted to Framework3.5SP1). However, when I launch it (with ASP.NET Development Server), I get a message (from the browser) that there was a compilation error "Compiler Error Message: CS0234: The type or namespace name 'DirectoryServices' does not exist in the namespace 'System' (are you missing an assembly reference?)"

At the bottom of the error page, the version information: Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053

The server is using .NET Framework Version 2? But all my projects are targetted to 3.5

Is there a simple way to prevent this from happening?

I should add:

re-installed .net framework version 3.5 + sp1, still same issue. important to note here is that i'm not using full blown IIS, just the "Asp.net development server" supplied with VS2008. (CTRL + F5/Launch)

A: 

Just guessing here. Could it be that one of either your development machine or the server has upgraded to .Net 3.5 SP1 while the other has not?

Rune Grimstad
no. all is on the same machine.
slither
A: 

Chances are you machine web.config is referencing 2.0. You can reconfigure it to 3.5 through IIS management console. Or you can modify the <assemblies> element in your web.config to add <clear /> and explixitly specify <add assembly> for each 3.5 assembly.

Franci Penov
+3  A: 

Hi, The reason being .NET 3.5 is not a stand alone framework like v2.0 or v1.1 . It is just an extension of the 2.0 framework. The extension provides developers with new language features like Anonymous Types, Extension Methods, Lambda Expressions and of course LINQ .... and AJAX is now integrated. Therefore you just use 2.0 in IIS.

You should try to install .NET Framework 3.5 on that server, the IIS server will automatically use the correct version.

Regards, Sem

Sem Dendoncker
re-installed .net framework version 3.5 + sp1, still same issue. important to note here is that i'm not using full blown IIS, just the "Asp.net development server" supplied with VS2008
slither
just a thought but can you try to add System.DirectoryServices to you application. Somethimes VS thinks he has copied it but just didn't do it. I just tried it on my machine and it works but I have to reference System.DirectoryServices.
Sem Dendoncker
Hey thanks for the idea. I just found that my System.DirectoryServices reference was "Copy Local =False". turned this to "Copy Local = True", and now it works fine! :)
slither