sdk: [dotnet migrate]"bower install " & "dotnet bundle" commands from prepublish scripts section should not be migrated from project.json to csproj

Steps to reproduce

migrate project.json to csproj with prepublish section

Expected behavior

“bower install” & “dotnet bundle” is not added to the prepublishscript section in csproj.

Actual behavior

it is getting added.

Environment data

dotnet --info output:

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 27 (27 by maintainers)

Commits related to this issue

Most upvoted comments

I don’t think migration should drop these commands. It is fine for the new templates to not have them, but I don’t think it is ok for migration to assume that existing projects are not making use of it.

For instance, one of the issues pointed out is that bower install won’t work cross-platform. I honestly don’t see why not, as long as you have bower available on your path, it will work. Plus, if it was not working in project.json (for whatever reason), it is not the goal of migration to make your csproj now work.

Maybe I’m not following, but shouldn’t Bower always be available if the ASP.NET and web development workload is installed? See C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Web\External\bower.cmd. If Bower isn’t available on the path, would it be more appropriate to tell the user to modify their VS 2017 installation to include the aforementioned workload?

@tmds Feel free to add this section to your app if the app uses bower & bundling.

<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command=”bower install” EnvironmentVariables=”Path=$(ExternalToolsPath)” />
    <Exec Command="dotnet bundle" />
  </Target>

The new templates does not carry these section (by default) because some of these commands may be platform dependent. The default templates are meant to work on all platforms.