2013-07-26 72 views
1

我有一个已经工作了几年的解决方案。今天,我在几个月的不断发展中第一次增加了一个新项目。一切都很好,并编码。去建立并发现它找不到我添加的任何项目引用。Visual Studio 2012未能建立引用其他项目的新项目

类型或命名空间名称“嗒嗒”找不到(是否缺少使用direcive或程序集引用?)

这些提法都是在同一个解决方案项目和验证他们项目引用在CSPROJ文件中。 Visual Studio没有找到引用的问题,因为我可以很好地对引用的对象进行编码。只有当我建立我有问题。目前正在使用AnyCPU进行调试。

做了Google搜索,我一直发现这个问题可能是目标框架是我的新项目或引用中的.NET 4 Client Profile。然而,这种情况并非如此。所有项目都是.NET 4,而不是客户端配置文件(我已验证)。更奇怪的是,这些参考文件在现有项目中都运行良好。

如果我制作新的项目.NET 4.5让我觉得.NET 4的目标框架出现问题,我可以构建它。我目前已经迷路了,不知道该怎么做。

以下是项目文件。我必须清除文件名和项目名称。

<?xml version="1.0" encoding="utf-8"?> 
<Project ToolsVersion="4.0" DefaultTargets="Build" 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>{48AED04F-6928-45F4-8C1D-A5E6713B5120}</ProjectGuid> 
    <OutputType>Library</OutputType> 
    <AppDesignerFolder>Properties</AppDesignerFolder> 
    <RootNamespace>MyNamespace</RootNamespace> 
    <AssemblyName>MyNamespace</AssemblyName> 
    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> 
    <FileAlignment>512</FileAlignment> 
    <TargetFrameworkProfile /> 
    </PropertyGroup> 
    <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 
    <DebugSymbols>true</DebugSymbols> 
    <DebugType>full</DebugType> 
    <Optimize>false</Optimize> 
    <OutputPath>..\Build\Debug\</OutputPath> 
    <DefineConstants>DEBUG;TRACE</DefineConstants> 
    <ErrorReport>prompt</ErrorReport> 
    <WarningLevel>4</WarningLevel> 
    <Prefer32Bit>false</Prefer32Bit> 
    </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> 
    <Prefer32Bit>false</Prefer32Bit> 
    </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.Xml" /> 
    </ItemGroup> 
    <ItemGroup> 
    <Compile Include="SomeFileThatReferences.cs" /> 
    <Compile Include="Properties\AssemblyInfo.cs" /> 
    </ItemGroup> 
    <ItemGroup> 
    <ProjectReference Include="..\Ref1.csproj"> 
     <Project>{6E0EEABF-52D7-4020-9242-AFDC33B5DAA0}</Project> 
     <Name>Billing.Bills</Name> 
    </ProjectReference> 
    <ProjectReference Include="..\Ref2.csproj"> 
     <Project>{6764A403-DA4C-42FF-A89F-E1EEA7FEF0A3}</Project> 
     <Name>Billing.Business</Name> 
    </ProjectReference> 
    <ProjectReference Include="..\Ref3.csproj"> 
     <Project>{9D9AB79F-D52A-4EC8-B2B7-9C605EFDBFDE}</Project> 
     <Name>Billing.Reports</Name> 
    </ProjectReference> 
    <ProjectReference Include="..\Csla\Csla.Net4\Csla.Net4.csproj"> 
     <Project>{1FCE45FF-C391-4ED1-A9C4-F71CAF8773E6}</Project> 
     <Name>Csla.Net4</Name> 
    </ProjectReference> 
    <ProjectReference Include="..\Ref4.csproj"> 
     <Project>{3972242B-DF6A-4B9B-9121-6138090CA114}</Project> 
     <Name>Core</Name> 
    </ProjectReference> 
    </ItemGroup> 
    <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 
    <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
     Other similar extension points exist, see Microsoft.Common.targets. 
    <Target Name="BeforeBuild"> 
    </Target> 
    <Target Name="AfterBuild"> 
    </Target> 
    --> 
</Project> 

在此先感谢您的任何答案/建议。

+0

2012似乎不支持从我迄今为止测试的框架4.0 ....我可能是错的,我还没有尝试过所有的东西...... – legrandviking

+0

这很奇怪。似乎所引用的文件将是.NET 4.5 – Jonesopolis

+4

@legrandviking - VS 2012肯定支持4.0 – EkoostikMartin

回答

2

想通了。显然我错过了一个我不知道的参考资料。所有其他项目都参考了Microsoft的BCL Portability Pack。一旦我在NuGet中看到它,并且所有的项目都有它,除了新的项目,我立即引用它,现在一切都在建立。

这是一个有趣的幽灵狩猎。

0

这个恼人的错误的另一个原因。通过查看警告消息找到了这一点。在建的错误消息并没有给所需要的信息:

警告6的主要参考“C:... 路径到您的解决方案-REF .dll文件” 无法得到解决,因为它是针对 “.NETFramework,Version = v4.5.1”框架构建。这是比当前有针对性的框架“.NETFramework,Version = v4.5”更高版本 。

因为我在干净的VStudio安装,看起来像默认项目还没有设置为更高的版本,因为我有它。因此,版本差异(从较低版本引用更高版本)将执行此操作。

相关问题