Reference added but Namespace is not recognized

前端 未结 8 1602
不知归路
不知归路 2021-01-11 12:56

I added a DLL to my project. The DLL contains the namespace test.security. Now, test.security is not recognized. Why is this?

I am using this DLL in oth

8条回答
  •  温柔的废话
    2021-01-11 13:30

    Are you using Client Profile as a project target? Consider this scenario:

    Project A -> Project targets .NET Framework 4.0

    Project B -> Project targets .NET Framework 4.0 Client Profile

    Project A is referenced by Project B. Namespaces in Project A are not recognised in Project B.

    If ths scenario matches, this is due to a target mismatch. Client Profile supports a subset of the BCL of the full framework. If an assembly is dependent on using the full framework (like requiring types from System.Web, etc.) then it won't be useable from an assenbly that only supports Client Profile.

    Easy solution, change Project B to .NET Framework 4.0 (not Client Profile).

提交回复
热议问题