[英]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.