【问题标题】:Files missing in publish folder for angular 2 .net core projectangular 2 .net core 项目的发布文件夹中缺少文件
【发布时间】:2017-03-20 22:38:40
【问题描述】:

我在 net core 中使用 angular 2 的模板,如下所示 http://blog.stevensanderson.com/2016/10/04/angular2-template-for-visual-studio/ 。当我发布解决方案时,ClientApp 文件夹中“app”中的文件完全丢失。我在这个文件夹中有所有的角度组件,它没有被发布。

【问题讨论】:

    标签: angular .net-core


    【解决方案1】:

    project.json vs csproj 文档中的The files section 解释了解决方案。

    如果您使用的是project.json

    {
      "publishOptions": {
        "include": [
          "app/"
        ]
      }
    }
    

    如果您使用的是csproj

    <ItemGroup>
        <Content Include="app\**\*" CopyToPublishDirectory="PreserveNewest" />
    </ItemGroup>
    

    【讨论】:

    • @Maverik 你正在使用 project.json... 对吗?
    • 是的。我正在为 angular2 使用 .net 核心模板;附带 project.json
    【解决方案2】:

    为了包含我的客户端脚本,我将这一行添加到我的 .csproj 文件中的其他 &lt;Content&gt; 行下:

    <Content Include="Client\dist\**\*.*" />
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-05-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-03
      • 2019-07-12
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多