简体   繁体   English

Visual Studio 2017 RC如何在csproj文件中指定发布选项

[英]Visual Studio 2017 RC How to specify Publishing Options in the csproj file

I have been working on VS2017 RC. 我一直在研究VS2017 RC。

I ultimately want to run a react SPA project out of the ASPNETCORE project. 我最终想要从ASPNETCORE项目中运行一个反应SPA项目。 To this end the template I was basing this on is a VS2015 one with a project.json file. 为此,我基于此的模板是一个带有project.json文件的VS2015。

In the VS2015 project.json file I have two items that ordinarily do not appear in the standard ASPNETCORE template. 在VS2015 project.json文件中,我有两个通常不会出现在标准ASPNETCORE模板中的项目。

The two things I want to include are as follows: 我想要包括的两件事情如下:

 "publishOptions": {
"include": [
  "wwwroot",
  "web.config"
],
"exclude": [
  "node_modules",
  "**.xproj",
  "**.user",
  "**.vspscc"
  ]
},

  "scripts": {
    "prepublish": [
    "npm install",
    "node node_modules/webpack/bin/webpack.js --config    webpack.config.vendor.js",
    "node node_modules/webpack/bin/webpack.js"
],

I have looked high and low as to where you would add this to the csproj file. 我在高低处看到了将其添加到csproj文件的位置。 I have tried modifying the csproj file but after I do that the project crashes and ends up with various errors and warnings. 我已经尝试修改csproj文件,但在我这样做后,项目崩溃并最终出现各种错误和警告。

How do you add these into the project via VS2017? 如何通过VS2017将这些添加到项目中?

How to you modify the csproj file outside the project without crashing your project. 如何修改项目外的csproj文件而不会导致项目崩溃。

You can refer to Project.json to MSBuild conversion guide 您可以参考Project.json到MSBuild转换指南

scripts: 脚本:

{
  "scripts": {
    "precompile": "generateCode.cmd",
    "postpublish": [ "obfuscate.cmd", "removeTempFiles.cmd" ]
  }
}

<Target Name="MyPreCompileTarget" BeforeTargets="Build">
  <Exec Command="generateCode.cmd" />
</Target>

<Target Name="MyPostCompileTarget" AfterTargets="Publish">
  <Exec Command="obfuscate.cmd" />
  <Exec Command="removeTempFiles.cmd" />
</Target>

publishOptions: publishOptions:

  "publishOptions": {
    "include": [
      "files/",
      "publishnotes.txt"
    ]
  }

<ItemGroup> 
  <Content Include="files\**\*" CopyToPublishDirectory="PreserveNewest" />
  <None Include="publishnotes.txt" CopyToPublishDirectory="Always" />
  <!-- CopyToPublishDirectory = { Always, PreserveNewest, Never } -->
</ItemGroup>

I usually use notepad or notepad++ to edit .csporj then reopen visual studio 2017 :) 我通常使用记事本或记事本++编辑.csporj然后重新打开视觉工作室2017 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何让Visual Studio 2017接受对csproj文件的修改 - How to have Visual Studio 2017 accept modifications to csproj file Xamarin Forms不会在Visual Studio 2017中创建.csproj文件 - Xamarin Forms does not create .csproj file in Visual Studio 2017 如何在Visual Studio 2017项目(新的.csproj文件格式)中设置`OutputPath`,而不会使目标框架混乱已解析的路径? - How do I set `OutputPath` in a Visual Studio 2017 project (new .csproj file format) without the target framework cluttering the resolved path? Visual Studio 2017 RC 中缺少 Reportviewer 工具 - Reportviewer tool missing in visual studio 2017 RC 为什么Visual Studio 2017会发布整个解决方案? - Why Visual studio 2017 is publishing entire solution? 使用Visual Studio 2017的新csproj格式如何添加对较旧可移植库的支持? - Using the new csproj format for Visual Studio 2017 how to add support for the older portable libraries? 通过TFS Visual Studio构建任务发布.csproj - Publishing a .csproj through TFS visual studio build task 如何在Visual Studio 2010中恢复损坏的.csproj文件? - How can I recover a corrupt .csproj file in Visual Studio 2010? 如何在 Visual Studio 中添加对 .csproj 文件的项目引用? - How to add a project reference to a .csproj file in Visual Studio? 将解决方案从 Visual Studio 2017 RC 降级到 Visual Studio 2015 - Downgrading solution from Visual Studio 2017 RC to Visual Studio 2015
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM