我有一個已經工作了幾年的解決方案。今天,我在幾個月的不斷髮展中第一次增加了一個新項目。一切都很好,並編碼。去建立並發現它找不到我添加的任何項目引用。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>
在此先感謝您的任何答案/建議。
2012似乎不支持從我迄今爲止測試的框架4.0 ....我可能是錯的,我還沒有嘗試過所有的東西...... – legrandviking
這很奇怪。似乎所引用的文件將是.NET 4.5 – Jonesopolis
@legrandviking - VS 2012肯定支持4.0 – EkoostikMartin