我一直在研究VS2017 RC。
我最终想要从ASPNETCORE项目中运行一个反应SPA项目。为此,我基于此的模板是一个带有project.json文件的VS2015。
在VS2015 project.json文件中,我有两个通常不会出现在标准ASPNETCORE模板中的项目。
我想要包括的两件事情如下:
"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"
],
关于将其添加到csproj文件的位置,我看起来很高。我已经尝试修改csproj文件,但在我这样做之后,项目崩溃并最终出现各种错误和警告。
如何通过VS2017将这些添加到项目中?
如何在不破坏项目的情况下修改项目外的csproj文件。
答案 0 :(得分:13)
您可以参考Project.json to MSBuild conversion guide
脚本:
{
"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": {
"include": [
"files/",
"publishnotes.txt"
]
}
<ItemGroup>
<Content Include="files\**\*" CopyToPublishDirectory="PreserveNewest" />
<None Include="publishnotes.txt" CopyToPublishDirectory="Always" />
<!-- CopyToPublishDirectory = { Always, PreserveNewest, Never } -->
</ItemGroup>
我通常使用记事本或记事本++编辑.csporj然后重新打开视觉工作室2017 :)