Visual Studio 2017 RC How to specify publishing options in a csproj file

I worked on the VS2017 RC.

Ultimately, I want to start a SPA project project from an ASPNETCORE project. For this purpose, the template I based on this is VS2015 with the project.json file.

In the VS2015 project.json file, I have two elements that usually do not appear in the standard ASPNETCORE template.

The two things I want to include are the following:

"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 looked high and low where you could add this to the csproj file. I tried modifying the csproj file, but after I do this, the project crashes and ends with various errors and warnings.

How do you add them to a project through VS2017?

How do you modify the csproj file outside the project without crashing the project.

+7
c # visual-studio-2017
source share
1 answer

You can refer to Project.json for the MSBuild Conversion Guide

scenarios:

 { "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> 

I usually use notepad or notepad ++ to edit .csporj and then open visual studio 2017 again :)

+10
source share

All Articles