C# 找不到元数据文件.dll
我的项目找不到名称空间。有人知道问题出在哪里吗 我尝试了很多方法来解决这个问题。但没有一个有效 我尝试过:清洁解决方案、构建解决方案、重构和 在解决方案上单击鼠标右键,然后单击“属性” 单击左侧的配置 确保选中了无法找到的项目的“生成”下的复选框 如果已经选中,取消选中,点击apply并再次选中复选框 这是我的代码截图。C# 找不到元数据文件.dll,c#,asp.net,class,namespaces,n-tier-architecture,C#,Asp.net,Class,Namespaces,N Tier Architecture,我的项目找不到名称空间。有人知道问题出在哪里吗 我尝试了很多方法来解决这个问题。但没有一个有效 我尝试过:清洁解决方案、构建解决方案、重构和 在解决方案上单击鼠标右键,然后单击“属性” 单击左侧的配置 确保选中了无法找到的项目的“生成”下的复选框 如果已经选中,取消选中,点击apply并再次选中复选框 这是我的代码截图。 调试 任意CPU {DD7D144A-06C0-482A-9142-3CD989CCC7A4} 图书馆 性质 恩蒂尔 恩蒂尔 v4.6.1 512 真的 满的 假的 bin
调试
任意CPU
{DD7D144A-06C0-482A-9142-3CD989CCC7A4}
图书馆
性质
恩蒂尔
恩蒂尔
v4.6.1
512
真的
满的
假的
bin\Debug\
调试;痕迹
促使
4.
pdbonly
真的
bin\Release\
痕迹
促使
4.
{a42bdcd5-0ec1-4d2a-b96a-92e39138e9cb}
恩蒂尔·达尔
{70a4d682-67bb-456b-a21d-f343b43fe1b6}
域名
这是你要的代码。希望您能帮助解决我的问题。原因是
ProductLogic
类中的名称空间与NTier.Domain
名称空间中的产品类名称之间存在冲突。这与项目参考没有多大关系。在这种情况下,VS优先于当前名称空间,而不是来自其他名称空间的类。
在这种情况下,您需要每次为每个产品类使用NTier.Domain.Product
,或者将NTier.BLL.Product
名称空间更改为其他名称空间;例如NTier.BLL.ProductLogic
你“不能”使用Ntier.Domain
名称空间(参考附加的屏幕截图和其中的注释):它变灰了,因为它根本没有被使用(由于VS没有将代码中使用的任何产品字符串连接到您希望它执行的类,而是连接到当前名称空间,因此未使用Ntier.Domain
中的任何类,并且VS说您“可以删除该引用,它未使用”),以检查:
如果您将鼠标放在产品参考上,您会看到类似的内容:
这会通知您VS在那里没有看到类,而是在您定义类“Product”的当前命名空间中,可能在引用的项目中?你能,请,共享.csproj文件吗?看看新帖子。我无法共享此评论中的代码。请,编辑你的问题并添加.csproj文件内容。我需要查看项目.csproj文件,而不是类Product,我甚至无法在.csproj文件中获取。。。。
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{DD7D144A-06C0-482A-9142-3CD989CCC7A4}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NTier.BLL</RootNamespace>
<AssemblyName>NTier.BLL</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Admin\AdminLogic.cs" />
<Compile Include="Customer\CustomerLogic.cs" />
<Compile Include="Admin\IAdminLogic.cs" />
<Compile Include="Customer\ICustomerLogic.cs" />
<Compile Include="Customer\INotRegularCustomerLogic.cs" />
<Compile Include="Customer\IRegularCustomerLogic.cs" />
<Compile Include="Customer\NotRegularCustomerLogic.cs" />
<Compile Include="Customer\RegularCustomerLogic.cs" />
<Compile Include="Order\IOrderLogic.cs" />
<Compile Include="Order\OrderLogic.cs" />
<Compile Include="Product\IProductLogic.cs" />
<Compile Include="Review\IReviewLogic.cs" />
<Compile Include="Product\ProductLogic.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Review\ReviewLogic.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NTier.DAL\NTier.DAL.csproj">
<Project>{a42bdcd5-0ec1-4d2a-b96a-92e39138e9cb}</Project>
<Name>NTier.DAL</Name>
</ProjectReference>
<ProjectReference Include="..\NTier.Domain\NTier.Domain.csproj">
<Project>{70a4d682-67bb-456b-a21d-f343b43fe1b6}</Project>
<Name>NTier.Domain</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>