Javascriptservices: TFS build and release?

Created on 20 Mar 2017  路  5Comments  路  Source: aspnet/JavaScriptServices

Anyone have experience using TFS to build and release a project using this template, especially the ng2 template?

We've enjoyed single-button builds and deploys, but have had no luck finding a way to incorporate node/ng2 solutions into TFS online.

Most helpful comment

Similar questions. For Azure deployments, in project.json, there used to be pre-publish tasks to run npm scripts. What is the story with csproj?

All 5 comments

Similar questions. For Azure deployments, in project.json, there used to be pre-publish tasks to run npm scripts. What is the story with csproj?

If you look at the latest code in the templates\Angular25Spa directory, there is the new .csproj file. It has all the magic code to run the webpack/npm scripts, and also to include all the generated files in your wwwroot\dist folder, which is tricky to figure out without this example.

https://github.com/aspnet/JavaScriptServices/blob/dev/templates/Angular2Spa/Angular2Spa.csproj

@rgamage Thanks for pointing out. I did my project migrated using dotnet migrate, which produces a little different section for including wwwroot/dist artifacts and the pre publish commands were not included as part of migration from project.json > project.csproj. So I am guess there is some manual treatment to this file. But it works as expected.

Existing Item group

  <ItemGroup>
    <Compile Remove="node_modules\**\*;Client\**\*" />
    <Content Include="wwwroot\assets\**\*" />
    <None Update="wwwroot\**\*;Views\**\*;Dockerfile">
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
    </None>
  </ItemGroup>




Copied from Angular2Spa.csproj file:

    <!-- Include the newly-built files in the publish output -->
    <ItemGroup>
      <DistFiles Include="wwwroot\dist\**;" />
      <ResolvedFileToPublish Include="@(DistFiles->'%(FullPath)')" Exclude="@(ResolvedFileToPublish)">
        <RelativePath>%(DistFiles.Identity)</RelativePath>
        <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
      </ResolvedFileToPublish>
    </ItemGroup>
  </Target>

Can these two sections be combined or they are serving different purpose.

Its very difficult to understand XML :) or is there any documentation around new csproj schema?

Thanks

For general MSBuilds docs, please see https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild

As for your specific question about whether you can combine the two <ItemGroup> elements, yes as far as I know you can. But generally it's nice to keep independent concerns separate.

Awesome, Thanks @SteveSandersonMS .

Was this page helpful?
0 / 5 - 0 ratings