Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing assembly after build

Tags:

c#

I have 5 projects in my C# solution.

  1. Common
  2. DataAccess.
  3. UI
  4. Components
  5. Test

I can add a reference to Components.dll. But, when I run the solution, I got the error:

The type or namespace name 'Components' does not exist.

The Components.dll is already present in the references folder.

Would you please help me?

Here is build output:

------ Rebuild All started: Project: Comps, Configuration: Release Any CPU ------
  Comps -> ..\Ashyaneh\Comps\bin\Release\AshyanehComps.dll
------ Rebuild All started: Project: Interfaces, Configuration: Debug Any CPU ------
  Interfaces -> ..\Ashyaneh\Interfaces\bin\Debug\AshyanehInterfaces.dll
------ Rebuild All started: Project: Common, Configuration: Debug Any CPU ------
  Common -> ..\Ashyaneh\Common\bin\Debug\AshyanehCommon.dll
------ Rebuild All started: Project: Web, Configuration: Debug Any CPU ------
  Web -> E:\My Programming 1391\HRShojaieWebAppRC2\Ashyaneh\Web\bin\Web.dll
------ Rebuild All started: Project: Test, Configuration: Debug x86 ------
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
warning MSB3253: The referenced assembly "AshyanehComps.dll" could not be resolved
because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a" which 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.
  Test -> ..\Ashyaneh\Test\bin\Debug\Test.exe
========== Rebuild All: 5 succeeded, 0 failed, 0 skipped ==========
like image 589
Mazdak Shojaie Avatar asked Jun 29 '12 14:06

Mazdak Shojaie


1 Answers

Here is your problem:

The referenced assembly "E:\My Programming 1391\HRShojaieWebAppRC2\Ashyaneh\Comps\bin\Release\AshyanehComps.dll" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client"

Assuming you are trying to run .NET 4.0 you are compiling against the "lightweight", Client Profile, Base Class Libraries. You need the full-blown Framework Class Libraries for System.Web to be included.

Solution

In order to change this right click on the Project for AshyanehComps.dll > click properties > click the "Application" tab > change the "Target Framework" to ".NET Framework 4".

Just to be safe I would follow the above steps for all of the projects in your solution and you should be good.

like image 152
John Culviner Avatar answered Sep 30 '22 17:09

John Culviner