George Geschwend
George Geschwend

Reputation: 183

Where to put "dotnet bundle" in .NET Core project (project.json replaced with *.csproj file)

Since the most recent .NET Core (I am actually using AspNetCore 1.1.2) has replace the project.json file with *.csproj it is still not clear to me where to put the "dotnet bundle", precompile option.

    "scripts": {
        "precompile": ["dotnet bundle"]
    }

Prior the above block of json was found in the project.json file. Any clue where this goes? Is it already in some other configuration file? Below is a link that explains this change, and shows what the *.csproj file equivalent is to the project.json file:

https://learn.microsoft.com/en-us/dotnet/core/tools/project-json-to-csproj

As always, apologies for any incorrect vernacular here, .NET Core is new to me.

Upvotes: 1

Views: 675

Answers (1)

omajid
omajid

Reputation: 15203

You can use Target and Exec to accomplish this in .csproj:

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

See this answer on how to get dotnet bundle to work with new .csproj format.

Upvotes: 3

Related Questions