microsoft / service-fabric-yarp

YARP integration with Service Fabric
MIT License
31 stars 9 forks source link

Unable to produce deployable project from source #9

Closed WhitWaldo closed 1 year ago

WhitWaldo commented 2 years ago

Hello,

Ideally, I'd like to mirror the source in my own repo and deploy updates via CI/CD, but I'm having no luck setting up such a deployment locally, let alone in DevOps. I followed the instructions for building it myself:

dotnet build dirs.proj
dotnet test dirs.proj
dotnet pack dirs.proj

I see that /out/bin/Debug-x64 is populated with folders for the various projects and services, but the format doesn't resemble what I'm used to seeing if I right click an sfproj project in Visual Studio and select package. I expect to see an output directory (typically in /<SfProjectName>/pkg/<buildTarget>) populated with directories for each service (e.g. "MyServicePkg/") and the ApplicationManifest.xml, but I don't see this produced anywhere.

Three questions then: 1) How can I change the directory to which this is outputting the packaged app? 2) How do I change the target (e.g. to Release)? 3) How do I get this to build such that I can extract the directory and produce my own sfpkg file?

Thanks!

egaribay77 commented 2 years ago

Hello,

If you want to build the SF pkg via command prompt or PowerShell instead of using Visual studio then try the following.

First need to install some tools:

  1. Install both NuGet.exe and MSBuild.exe. Install NuGet from here https://docs.microsoft.com/en-us/nuget/reference/nuget-exe-cli-reference#installing-nugetexe and install MSBuild from here https://docs.microsoft.com/en-us/visualstudio/msbuild/msbuild?view=vs-2022. If you have already installed VS then its possible its already installed, for me its located "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin". Alternatively, can try using "dotnet msbuild ..." instead but people have reported issues: https://github.com/microsoft/service-fabric/issues/907.
  2. (Optional) Add the folder where you placed nuget.exe and MSBuild.exe to your PATH environment variable to use the CLI tool from anywhere

Then do the following to restore, build and package SF app.

  1. dotnet build projects - dotnet build .\dirs.proj
  2. nuget restore on .sln -> nuget restore .\YarpSF.sln
  3. msbuild on .sln -> msbuild .\YarpSF.sln /p:configuration="Release"
  4. msbuild /t:package on sfproj -> msbuild ./src/YarpProxyApp/YarpProxyApp.sfproj /t:Package /p:PackageLocation=c:\temp\sfbuildout /p:platform="x64" /p:configuration="Release"

To create sfpkg try the following: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-package-apps#create-an-sfpkg To create CI/CD pipeline for SF app using Azure DevOps try the following: https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-deploy-app-with-cicd-vsts

Let me know if you have any issues with the above steps or have any questions.

egaribay77 commented 1 year ago

I hope the steps above helped. Closing this issue for now since have not heard back with a response.