Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.
/ SFNuGet.Build Public archive

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

License

Notifications You must be signed in to change notification settings

NickDarvey/SFNuGet.Build

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.)

About

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

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published