2

我在 Visual Studio for Mac 中尝试编译 .net 核心应用程序时遇到以下错误。

/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets(5,5): 
Error MSB3644: The reference assemblies for framework ".NETCoreApp,Version=v1.0" were not found. To resolve this, 
install the SDK or Targeting Pack for this framework version or retarget your application to a version of the framework for which you have the SDK or Targeting Pack installed. 
Note that assemblies will be resolved from the Global Assembly Cache (GAC) and will be used in place of reference assemblies. 
Therefore your assembly may not be correctly targeted for the framework you intend. (MSB3644) (Backend)

昨天这仍然有效!

这里是我的 csproj:

<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFramework>netcoreapp1.0</TargetFramework>
  <PreserveCompilationContext>true</PreserveCompilationContext>
  <RootNamespace>backend</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <DebugType></DebugType>
  <OutputPath>..\..\bin\</OutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  <OutputPath>..\..\bin\</OutputPath>
</PropertyGroup>
<ItemGroup>
  <Compile Include="**\*.cs" Exclude="$(GlobalExclude)" />
  <EmbeddedResource Include="**\*.resx" Exclude="$(GlobalExclude)" />
  <Compile Remove="Controller\Controller\SomController.cs" />
  <Compile Remove="Controller\Controller\UserController.cs" />
  <Compile Remove="Controller\SomController.cs" />
  <Compile Remove="Dto\LoginResultDto.cs" />
  <Compile Remove="Dto\UserDto.cs" />
  <Compile Remove="Models\SessionDto.cs" />
  <Compile Remove="Models\UserDto.cs" />
  <Compile Remove="Helper\SHA256.cs" />
  <Compile Remove="Filter\AuthFilter.cs" />
  <Compile Remove="Annotation\AllowAnonymousAccessAttribute.cs" />
  <Compile Remove="Database\BackendDbContext.cs" />
  <Compile Remove="Database\BackendDbInitializer.cs" />
</ItemGroup>

<ItemGroup>
  <PackageReference Include="Microsoft.NETCore.App">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.NET.Sdk.Web">
    <Version>1.0.0-alpha-20161104-2-112</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.AspNetCore.Diagnostics">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.AspNetCore.Server.Kestrel">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.Extensions.Logging.Console">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.AspNetCore.Mvc">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.AspNetCore.Mvc.Core">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.EntityFrameworkCore">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.AspNetCore.StaticFiles">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.Extensions.Logging.Debug">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.Extensions.Configuration.Json">
    <Version>1.1.0</Version>
  </PackageReference>
  <PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions">
    <Version>1.1.0</Version>
  </PackageReference>
</ItemGroup>

<ItemGroup>
  <Folder Include="Controller\" />
</ItemGroup>
<ItemGroup>
  <None Include="appsettings.json">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </None>
</ItemGroup>
<ItemGroup>
  <ProjectReference Include="..\BackenShared\BackenShared.csproj">
    <Project>{FC12C26A-316C-4B63-8A81-3A284F9AC04A}</Project>
    <Name>BackenShared</Name>
  </ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

我已经安装了 .net 核心版本 1.1.0。

当我改变

<TargetFramework>netcoreapp1.0</TargetFramework>

<TargetFramework>netcoreapp1.1</TargetFramework>

它仍然是同样的错误!我该如何解决这个问题?我怎么知道,Visual Studio 找到了框架?

4

0 回答 0