.NET Core 2应用程序构建但发布失败

时间:2017-10-08 17:57:31

标签: .net asp.net-core

构建.net core 2控制台时出现以下错误。 我只想创建一个可以在Windows服务器上运行的.exe。

这是我得到的错误

project.assets.json' doesn't have a target for '.NETCoreApp,Version=v2.0/win10-x64'. Ensure that restore has run and that you have included 'netcoreapp2.0' in the TargetFrameworks for your project. You may also need to include 'win10-x64' in your project's RuntimeIdentifiers.

这是我的csproj内容

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup Label="Globals">
  <SccProjectName>SAK</SccProjectName>
  <SccProvider>SAK</SccProvider>
  <SccAuxPath>SAK</SccAuxPath>
  <SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>

<PropertyGroup>
  <OutputType>Exe</OutputType>
  <TargetFramework>netcoreapp2.0</TargetFramework>
  <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers>    
</PropertyGroup>
<ItemGroup>
  <PackageReference Include="Telegram.Bot" Version="13.2.1" />
</ItemGroup>
</Project>

1 个答案:

答案 0 :(得分:0)

我同意以上评论,这似乎是VS的问题。我遇到了类似的问题:我卸载了问题项目,然后重新加载它,一切都很好。