【问题标题】:Dotnet publish-iis exit with code 1. Project.json not found when using .csproj?dotnet 发布-iis 退出,代码为 1。使用 .csproj 时找不到 Project.json?
【发布时间】:2016-11-28 13:15:13
【问题描述】:

我已将带有 project.json 文件的 NET Core 1.0 项目迁移到带有 .csproj 文件的 Net Core 1.1 项目。在 .csproj 文件的末尾,我有以下内容:

<ItemGroup>
  <DotNetCliToolReference Include="Microsoft.AspNetCore.Mvc.Razor.ViewCompilation.Tools" Version="1.1.0-preview4-final" />
  <DotNetCliToolReference Include="Microsoft.AspNetCore.Server.IISIntegration.Tools" Version="1.1.0-preview4-final" />
  <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.1.0-preview4-final" />
  <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.1.0-preview4-final" />        
</ItemGroup>  

<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

<Target Name="Prepublish" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
  <Exec Command="npm install" />
  <Exec Command="bower install" /> 
  <Exec Command="gulp clean" />
  <Exec Command="gulp build" />
</Target>  

<Target Name="Postpublish" AfterTargets="Publish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">    
  <Exec Command="dotnet publish-iis --publish-folder $(TargetDir) --framework $(TargetFrameworkIdentifier),Version=$(TargetFrameworkVersion)" />
</Target>    

发布项目时,我在 dotnet publish-iis 上收到错误:

exited with code 1.

我试图找到错误,但我发现的唯一内容是:

System.IO.FileNotFoundException: Could not find file 'C:\MVCProj\project.json'.

但是,如果我使用的是 .csproj,它为什么要查找 project.json 文件?

【问题讨论】:

    标签: asp.net-core


    【解决方案1】:

    如果你还在寻找答案,我发现publish-iis cli工具已经不再使用了。

    https://github.com/dotnet/cli/issues/4855#issuecomment-263799301

    您需要从您的 .csproj 文件中删除对 Microsoft.AspNetCore.Server.IISIntegration.Tools 包和 whoe PostpublishTarget 的引用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-30
      • 1970-01-01
      • 2015-01-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多