Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Namespace cannot be found after changing target framework from v4.0 to v3.5

I have 2 projects in a solution, 1 a dll, the other an exe. Both were using .net version 4.0 however no 4.0 specific libraries were used so it should be possible for me to safely change them to 3.5

I did this under both project properties, I built the dll fine. Now when i try to build the exe it cannot find the dll's namespace. I have readded the reference, but it still cant see it. When I reverted the .net version it did say I might have to modify the project files before it builds. I have tried to search for a solution via google but the key words I am using are too commonly used. Can anyone advise?

Many thanks, Chris

Edit: Tried the following already..

  • Reference DLL specifically whilst ensuring not 4.0 copy
  • Delete bin and obj folders
  • Restart VS
like image 874
Chris Avatar asked Feb 22 '11 19:02

Chris


2 Answers

Rather than referencing the output DLL, have you tried setting it as a project reference instead.

Also, have you done a clean build of the solution incase any .Net 4.0 files were lingering? You can manually clean the project by deleting the bin and obj folders.

Have you tried removing the projects from the solution, creating a new .net 3.5 project and compiling that. Then add in the ddl project (Add -> existing project) and compile, then add in exe project without reference, compile then add in the references.

Odd question, but have you check the name spaces still. Can you call in your project the namesapce, i.e. using mydllproject.model.myengine

like image 163
JonWillis Avatar answered Oct 21 '22 12:10

JonWillis


I would open your project files as XML. To do this, close the soltion and reopen the projects only by clicking the down arrow on the File/Open button and selecting Open With... XML (Text) Editor. Check to make sure each project has a ToolsVersion="4.0" in the header. Check the RootNamespace and TargetFrameworksVersion elements to see if they have the values that you expect. At the bottom of the file, check the ProjectReference element within the ItemGroup. Make sure the GUID in the project reference matches the GUID that is defined in your solution file.

Finally, make sure you clean your project before you rebuild it. If you're using source control, check out the project into a new, empty sandbox.

Good Luck!

like image 29
Paul Keister Avatar answered Oct 21 '22 13:10

Paul Keister