1

数年間機能しているソリューションがあります。今日、私は何ヶ月にもわたる絶え間ない開発の中で初めて新しいプロジェクトを追加しに行きました。すべてが問題なく、コード化されていました。ビルドに行ったところ、追加したプロジェクト参照が見つからないことがわかりました。

型または名前空間名 'blah' が見つかりませんでした (使用中のディレクトリまたはアセンブリ参照がありませんか?)

これらの参照は、同じソリューション内のプロジェクトに対するものであり、CSPROJ ファイル内のプロジェクト参照であることを確認しました。参照されたオブジェクトに対して問題なくコーディングできるため、Visual Studio は参照を見つけるのに問題はありません。問題があるのは、ビルドするときだけです。現在AnyCPUでデバッグ中。

Google 検索を行ったところ、新しいプロジェクトまたは参照のいずれかで、ターゲット フレームワークが .NET 4 クライアント プロファイルである可能性があるという考えを見つけ続けました。しかし、そうではありません。すべてのプロジェクトは .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>

回答/提案をお寄せいただきありがとうございます。

4

2 に答える 2