GithubHelp home page GithubHelp logo

nickdarvey / sfnuget.build Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 7 KB

MSBuild targets to get your SFNuGet Service Fabric services in amongst that application of yours.

License: MIT License

PowerShell 100.00%
service-fabric sfnuget nuget

sfnuget.build's Introduction

SFNuGet lets you package up Service Fabric services as NuGet packages. Unfortunately it copies your service package into your ApplicationPackageRoot and you'll end up committing it to source control.

SFNuGet.Build is designed to be added as a dependency to your SFNuGet package (via [a custom Package.xml](SFNuGet packages). It'll add itself as some MSBuild targets and copy your service packages at package time.

Creating a package

Using SFNuGet...

  1. Modify your Package.xml to refer to SFNuGet.Build as a dependency
     <dependencies>
         <dependency id="SFNuGet.Build" version="1.0.0" />
     </dependencies>
    
  2. Package your service as normal.

Using a package

  1. Install the package as normal

  2. If this is the first SFNuGet package you're adding to your application, update the .sfproj to import the SFNuGet.Build targets. Open the application project (.sfproj) in a text editor and import the MSBuild targets by adding this line:

    <Import Project="..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets" Condition="Exists('..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets')" />
    

    and to warn people who haven't run package restoration, add this under the ValidateMSBuildFiles target:

    <Error Condition="!Exists('..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets')" Text="Unable to find the '..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets' file. Please restore the 'SFNuGet.Build' NuGet package" />
    

    You should end up with this:

     <Import Project="$(ApplicationProjectTargetsPath)" Condition="Exists('$(ApplicationProjectTargetsPath)')" />
     <Import Project="..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.2\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets" Condition="Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.2\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets')" />
     <Import Project="..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets" Condition="Exists('..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets')" />
     <Target Name="ValidateMSBuildFiles">
         <Error Condition="!Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.2\build\Microsoft.VisualStudio.Azure.Fabric.Application.props')" Text="Unable to find the '..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.2\build\Microsoft.VisualStudio.Azure.Fabric.Application.props' file. Please restore the 'Microsoft.VisualStudio.Azure.Fabric.MSBuild' Nuget package" />
         <Error Condition="!Exists('..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.2\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets')" Text="Unable to find the '..\packages\Microsoft.VisualStudio.Azure.Fabric.MSBuild.1.6.2\build\Microsoft.VisualStudio.Azure.Fabric.Application.targets' file. Please restore the 'Microsoft.VisualStudio.Azure.Fabric.MSBuild' Nuget package" />
         <Error Condition="!Exists('..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets')" Text="Unable to find the '..\packages\SFNuGet.Build.1.0.0-alpha-00\build\SFNuGet.Build.targets' file. Please restore the 'SFNuGet.Build' NuGet package" />
     </Target>
    

    (I'd love this to be automated, but-.)

    Known issues

    • You gotta do that messy editing of your .sfproj
    • Your service package is still copied into ApplicationPackageRoot when it's first installed. (The first time you package the application, it'll get cleaned up. I haven't figured out how to stop SFNuGet from copying them without making a breaking change to it.)

sfnuget.build's People

Contributors

nickdarvey avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.