为什么从调试/发布模式切换会导致项目无法加载?

时间:2016-12-14 07:24:03

标签: visual-studio-2015

考虑这种情况,您可以在调试模式下创建一个包含2个项目A和B的解决方案(C#代码)。一切都很好,你想在发布模式下检查它,所以你切换到它,一旦你这样做,Visual Studio显示警告(对我来说随机)项目“B”无法加载。

我在解决方案解决后看到此行为解决方案。我必须卸载那些“失败”的项目并重新加载它们。它有效。然而,这完全是奇怪的,而且更糟糕 - 耗时。

这是什么原因?我在问,因为也许我可以系统地修复它。

更新

当我切换回一秒前工作的模式时,它再次无法加载某些项目(与之前相同)。所以简而言之,只有最后一个构建模式有效,当我切换到另一个时,我的项目失败了。

sln文件(3个项目):

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tools", "Tools\Tools.csproj", "{39AF8EA1-93D1-46FF-A00E-DD5303B29C92}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wpf.Tools", "Wpf.Tools\Wpf.Tools.csproj", "{B855F797-84A2-4CA5-9F24-0EAA34016359}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wpf.Controls", "Wpf.Controls\Wpf.Controls.csproj", "{E93AE909-EE0B-4948-9C1B-D5546FECEFCB}"
EndProject
Global
    GlobalSection(SolutionConfigurationPlatforms) = preSolution
        Debug|Any CPU = Debug|Any CPU
        Release|Any CPU = Release|Any CPU
    EndGlobalSection
    GlobalSection(ProjectConfigurationPlatforms) = postSolution
        {39AF8EA1-93D1-46FF-A00E-DD5303B29C92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {39AF8EA1-93D1-46FF-A00E-DD5303B29C92}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {39AF8EA1-93D1-46FF-A00E-DD5303B29C92}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {39AF8EA1-93D1-46FF-A00E-DD5303B29C92}.Release|Any CPU.Build.0 = Release|Any CPU
        {B855F797-84A2-4CA5-9F24-0EAA34016359}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {B855F797-84A2-4CA5-9F24-0EAA34016359}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {B855F797-84A2-4CA5-9F24-0EAA34016359}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {B855F797-84A2-4CA5-9F24-0EAA34016359}.Release|Any CPU.Build.0 = Release|Any CPU
        {E93AE909-EE0B-4948-9C1B-D5546FECEFCB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
        {E93AE909-EE0B-4948-9C1B-D5546FECEFCB}.Debug|Any CPU.Build.0 = Debug|Any CPU
        {E93AE909-EE0B-4948-9C1B-D5546FECEFCB}.Release|Any CPU.ActiveCfg = Release|Any CPU
        {E93AE909-EE0B-4948-9C1B-D5546FECEFCB}.Release|Any CPU.Build.0 = Release|Any CPU
    EndGlobalSection
    GlobalSection(SolutionProperties) = preSolution
        HideSolutionNode = FALSE
    EndGlobalSection
EndGlobal

其中一个csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.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>{39AF8EA1-93D1-46FF-A00E-DD5303B29C92}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Tools</RootNamespace>
    <AssemblyName>Tools</AssemblyName>
    <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <SccProjectName>SAK</SccProjectName>
    <SccLocalPath>SAK</SccLocalPath>
    <SccAuxPath>SAK</SccAuxPath>
    <SccProvider>SAK</SccProvider>
    <TargetFrameworkProfile />
  </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.Reactive.Core, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
      <HintPath>..\packages\System.Reactive.Core.3.0.0\lib\net45\System.Reactive.Core.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Reactive.Interfaces, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
      <HintPath>..\packages\System.Reactive.Interfaces.3.0.0\lib\net45\System.Reactive.Interfaces.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Reactive.Linq, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
      <HintPath>..\packages\System.Reactive.Linq.3.0.0\lib\net45\System.Reactive.Linq.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Reactive.PlatformServices, Version=3.0.0.0, Culture=neutral, PublicKeyToken=94bc3704cddfc263, processorArchitecture=MSIL">
      <HintPath>..\packages\System.Reactive.PlatformServices.3.0.0\lib\net45\System.Reactive.PlatformServices.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="System.Windows" />
    <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" />
    <Reference Include="WindowsBase" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="LogHelper.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="app.config" />
    <None Include="packages.config" />
  </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 个答案:

没有答案