【问题标题】:Where to put "dotnet bundle" in .NET Core project (project.json replaced with *.csproj file)在 .NET Core 项目中放置“dotnet bundle”的位置(project.json 替换为 *.csproj 文件)
【发布时间】:2018-03-02 13:12:58
【问题描述】:

由于最新的 .NET Core(我实际上使用的是 AspNetCore 1.1.2)已经用 *.csproj 替换了 project.json 文件,因此仍然不清楚对我来说,将“dotnet bundle”放在哪里,预编译选项。

    "scripts": {
        "precompile": ["dotnet bundle"]
    }

之前在 project.json 文件中找到了上述 json 块。有什么线索吗?它是否已经在其他配置文件中?以下是解释此更改的链接,并显示了 *.csproj 文件等效于 project.json 文件:

https://docs.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj

与往常一样,对于此处的任何不正确的白话表示歉意,.NET Core 对我来说是新的。

【问题讨论】:

    标签: json .net-core csproj


    【解决方案1】:

    您可以使用Target 和Exec to accomplish this in .csproj:

    <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
      <Exec Command=”bower install” EnvironmentVariables=”Path=$(ExternalToolsPath)” />
      <Exec Command="dotnet bundle" />
    </Target>
    

    请参阅this answer,了解如何让dotnet bundle 使用新的.csproj 格式。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-03
      • 2017-09-02
      • 2017-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多