How to use MSbuild on sfproj?

Trying to get my Application Fabric application on a build server. When I create the .sln file, the target of the sfproj package does not start. As expected. I can not get MSBuild to run this target.

First, the only targets available when creating against the .sln file are standard build and publish objects.

Secondly, the creation is against .sfproj itself. Sets the target. However, due to the $ (BuildPlatform) mismatch, the projects referenced by .sfproj are not building correctly .. sfproj has an x64 platform. Most of my other projects are any processor.

This is a lesser question about the service structure and most likely a general MSBuild question. I am looking for a solution that does not require me to combine all my platform options. The service fabric is REALLY x64 only, and my other projects are REALLY any processor.

[EDIT]

I solved it. What I did was add a new Target to the .sfproj file called MaybePublish , and I set it as one of the default targets. MaybePublish has Condition for '$(Package)' == 'true' . It has DependsOnTarget installed on Package . Basically, this target option can pack a Service Fabric application if the property is set when building the solution.

It seems to me that this is probably the way DeployOnBuild works in web publishing projects. Fabric service target files must have this type of support by default.

+9
source share
5 answers

I solved it. What I did was add a new Target to the .sfproj file called MaybePublish, and I set it as one of the default targets. MaybePublish has a condition for '$ (Package)' == 'true'. This parameter DependsOnTarget has a package installed. Basically, this target option can pack a Service Fabric application if the property is set when building the solution.

I think this is probably how DeployOnBuild works in web publishing projects. Fabric service target files must have this type of support by default.

+1
source

To help explain wasabi's answer. Here is what I did to get this to work.

I added the following Target to my *.sfproj file

 <Target Name="CreatePackage" Condition="'$(CreatePackage)' == 'true'" DependsOnTargets="Package" /> 

I also changed the value of the Project element DefaultTargets as Build;CreatePackage .

To create a package as part of my automatic build, I included /p:CreatePackage="true" as an argument to the solution step of my build.

+9
source

You can also complete the package step by running MSBuild in sfproj using the /t:Package switch.

+3
source

Try the following commands:

msbuild yours.sfproj & msbuild / t: Package yours.sfproj

The first part builds the SF project, as well as all the projects to which it refers. The second part packs the SF application.

+1
source

This can happen after the link to Microsoft.VisualStudio.Azure.Fabric.MSBuild.xxx has the wrong version number, for example, if you just created a cluster application and then launched the update package from the package manager console.

Check your package folder. The folder name "Microsoft.VisualStudio.Azure.Fabric.MSBuild.xxx" should correspond to the link in the sfproj file. If the build number does not match, search and replace in the sfproj file.

You should now be able to build your project.

0
source

All Articles