JetBrains / teamcity-dotnet-plugin

TeamCity plugin for .NET projects
Apache License 2.0
94 stars 25 forks source link

Precompile and Prepublish scripts #43

Closed Loudman closed 7 years ago

Loudman commented 7 years ago

Is there any way that the publish run the following script:

"prepublish": ["dotnet bundle"], or "precompile": "dotnet bundle",

I really need to run "dotnet bundle" in order to generate all the minified files

dtretyakov commented 7 years ago

Hi,

If you are still using project.json you could make changes according to the dotnet-bundle command docs: https://github.com/madskristensen/BundlerMinifier/wiki#command-line-interface-net-core

If you're moving to csproj you could declare tools in the project and set prepublish target like that:

...
<ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" />
    <DotNetCliToolReference Include="Microsoft.DotNet.Xdt.Tools" Version="1.1.0" />
  </ItemGroup>
...
  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="bower install" />
    <Exec Command="dotnet bundle" />
  </Target>
...