你电脑是安装的 .net framework 版本是多少?.csproj 中 TargetFrameworkVersion
的值是什么?
电脑安装的好像是4.0,而.csproj 中TargetFrameworkVersion是4.5.2。我现在安装FrameworkVersion4.5.2试一下。非常感谢您的回答!
但是我安装提示我“这台计算机中已经安装了 .NET Framework 4.5.2 或版本更高的更新。”
@励码万言: 那应该是 .csproj 的原因,删除其中对 Microsoft.CSharp.Core.targets
的引用。
@dudu:
nin您说的是这个吗?我并没有找到对Microsoft.CSharp.Core.targets的引用。删除这个后运行项目提示:该项目中不存在目标“Build”。
@励码万言: 建议提供一下完整的 .csproj 文件内容
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props" Condition="Exists('..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props')" />
<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>
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{641F0AFA-1071-4C78-8C7B-67F861EC5C8B}</ProjectGuid>
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Ruiec.CloudInnovate.CloudBackstageWeb</RootNamespace>
<AssemblyName>Ruiec.CloudInnovate.CloudBackstageWeb</AssemblyName>
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<UseIISExpress>true</UseIISExpress>
<Use64BitIISExpress />
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">
<HintPath>......\Library\Autofac.dll</HintPath>
</Reference>
<Reference Include="Autofac.Configuration">
<HintPath>......\Library\Autofac.Configuration.dll</HintPath>
</Reference>
<Reference Include="Autofac.Integration.Mvc">
<HintPath>......\Library\Autofac.Integration.Mvc.dll</HintPath>
</Reference>
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>......\Library\EntityFramework.dll</HintPath>
</Reference>
<Reference Include="EntityFramework.SqlServer">
<HintPath>......\Library\EntityFramework.SqlServer.dll</HintPath>
</Reference>
<Reference Include="log4net">
<HintPath>......\Library\log4net.dll</HintPath>
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>......\Library\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Entity" />
<Reference Include="System.Web.ApplicationServices" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Helpers">
<HintPath>......\Library\System.Web.Helpers.dll</HintPath>
</Reference>
<Reference Include="System.Web.Mvc">
<HintPath>......\Library\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web.Razor">
<HintPath>......\Library\System.Web.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages">
<HintPath>......\Library\System.Web.WebPages.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.Deployment.dll</HintPath>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.AspNet.WebPages.3.2.6\lib\net45\System.Web.WebPages.Razor.dll</HintPath>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Web.Services" />
<Reference Include="System.EnterpriseServices" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.Web.Infrastructure">
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Compile Include="App_Start\DataAccessInject.cs" />
<Compile Include="App_Start\EntityFrameworkInject.cs" />
<Compile Include="App_Start\FileHtmlHelper.cs" />
<Compile Include="App_Start\MyViewEngine.cs" />
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="App_Start\ServiceInject.cs" />
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Include="Web.Debug.config">
<DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
<DependentUpon>Web.config</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ruiec.CloudInnovate.CloudBackstageControllers\Ruiec.CloudInnovate.CloudBackstageControllers.csproj">
<Project>{2bbbbe13-3d12-4bf3-90d9-196be73c15ca}</Project>
<Name>Ruiec.CloudInnovate.CloudBackstageControllers</Name>
</ProjectReference>
<ProjectReference Include="..\Ruiec.CloudInnovate.Common.Models\Ruiec.CloudInnovate.Common.Models.csproj">
<Project>{a8b6a73d-7406-4f77-9727-3b288d8836f2}</Project>
<Name>Ruiec.CloudInnovate.Common.Models</Name>
</ProjectReference>
<ProjectReference Include="..\Ruiec.CloudInnovate.Common.Utility\Ruiec.CloudInnovate.Common.Utility.csproj">
<Project>{4c10521a-101a-4cce-b01b-d0f97b5eecff}</Project>
<Name>Ruiec.CloudInnovate.Common.Utility</Name>
</ProjectReference>
<ProjectReference Include="..\Ruiec.CloudInnovate.DataAccess\Ruiec.CloudInnovate.DataAccess.csproj">
<Project>{c7142c05-af47-43e7-9b7d-061dbd46e14d}</Project>
<Name>Ruiec.CloudInnovate.DataAccess</Name>
</ProjectReference>
<ProjectReference Include="..\Ruiec.CloudInnovate.Repository\Ruiec.CloudInnovate.Repository.csproj">
<Project>{6fac1b83-590b-4016-a3dc-54e6e6bce505}</Project>
<Name>Ruiec.CloudInnovate.Repository</Name>
</ProjectReference>
<ProjectReference Include="..\Ruiec.CloudInnovate.Services\Ruiec.CloudInnovate.Services.csproj">
<Project>{4043ef5d-dd5f-444d-8d25-ca8b128c1b1f}</Project>
<Name>Ruiec.CloudInnovate.Services</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" Condition="false" />
<ProjectExtensions>
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>2154</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:2154/</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>
<UseCustomServer>False</UseCustomServer>
<CustomServerUrl>
</CustomServerUrl>
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
</WebProjectProperties>
</FlavorProperties>
</VisualStudio>
</ProjectExtensions>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.2.6.1\build\Microsoft.Net.Compilers.props'))" />
</Target>
<!-- 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>
这个是csproj文件的大致内容,谢谢!
@励码万言: 试试把 Microsoft.Net.Compilers.2.6.1
的部分都去掉
@dudu:非常感谢,我通过NuGet升级Microsoft.Net.Compilers包解决了问题。