Create an activity package
Generate an activity package from the template, understand its projects, pack it once and see it in Studio.
This page creates a package Contoso.Invoices.Activities from the template, packs it, and installs it in Studio. The rest of the Activity SDK pages build on it. Prerequisites: the template is installed. See Set up your environment. Create the projects# PowerShellCopydotnet new velophex-activity -n Contoso.Invoices --prefix contoso.invoices --category "Invoices" Option Default Sets -n the current folder's name The solution name, the project names and the package id (<name>.Activities) --prefix the name in lower case The type id prefix of every activity (contoso.invoices.sayHello) and of the sample scope's kind. Permanent once you ship. --category the last part of the name The toolbox category of the sample activities. Name the task, not the product. --design off Adds a sample fluent design class (HelloDesign.cs). See Design-time experience. The velophex prefix is reserved for VeloPhex's own packages. The build refuses velophex and any prefix that starts with velophex.. What you get# TextCopyContoso.Invoices/ Contoso.Invoices.slnx Directory.Build.props version, authors, type id prefix Directory.Packages.props VeloPhex.Versions.props the VeloPhex SDK versions this package builds against README.md package/Contoso.Invoices.Activities.Package/ Contoso.Invoices.Activities.Package.csproj produces the .nupkg LICENSE.txt README.md packed into the package src/Contoso.Invoices.Activities/ Contoso.Invoices.Activities.csproj your activities (packed into lib/) SayHelloActivity.cs sample activity UseGreeterActivity.cs sample scope: Use Greeter, End Use Greeter, Greet icons/package.svg the package logo icons/SayHello.svg, icons/Greeter.svg one icon per icon key Project Ships as References src/Contoso.Invoices.Activities (the runtime project) lib/net10.0/ in the package: what Studio's executor and the Robot load Velophex.Workflow.Sdk package/Contoso.Invoices.Activities.Package (the package project) The .nupkg, with the generated manifest and design document The runtime project, Velophex.Workflow.Sdk, VeloPhex.ActivityPackage.Build Things the template sets up for you, and why: The runtime project is IsPackable=false and has its own PackageId (Contoso.Invoices.Activities.Runtime). Only the package project produces a package; a second project with the same id would confuse NuGet. The package project references the runtime project with PrivateAssets="all" and PackageFolder="lib". That is how the build knows which assembly goes into lib/, and it keeps the runtime project from becoming a separate NuGet dependency. Velophex.Workflow.Sdk is the package's one real dependency. It is MIT licensed and restored next to your package. TreatWarningsAsErrors is on, and the version is a prerelease (1.0.0-preview.1) because a stable package cannot depend on a prerelease SDK. The VeloPhex versions# VeloPhex.Versions.props holds the versions the template was published with: VeloPhex.Versions.propsXMLCopy<Project> <PropertyGroup> <VelophexWorkflowSdkVersion>…</VelophexWorkflowSdkVersion> <VelophexStudioSdkVersion>…</VelophexStudioSdkVersion> <VelophexActivityPackageBuildVersion>…</VelophexActivityPackageBuildVersion> <VelophexEngineVersionRange>[…, 1.0.0)</VelophexEngineVersionRange> </PropertyGroup> </Project> They belong together: the build tool, the runtime SDK and the design-time SDK come from one VeloPhex release, and the engine range starts at the engine version of that release. Change them only together, to the values of one newer release. See Engine compatibility. The samples# Say Hello (SayHelloActivity.cs) shows a plain activity: a card property, a design-time range rule on Repeat, and Suffix, which only appears while Style is Formal. Use Greeter (UseGreeterActivity.cs) shows a scope: an open step, a close step and a child activity that uses the open step's live object. See Scopes. Keep them as references while you start, or delete them. If you delete them, also delete their icons, and add at least one activity of your own: a package that declares no activities fails to pack (VXMAN002). Pack it# PowerShellCopydotnet pack Contoso.Invoices -c Release -o out The build stages the package, checks it, and writes the manifest and design document. The output ends with one summary line and the package: TextCopyContoso.Invoices.Activities: info VXDSN000: 4 activities, 3 card properties, 1 condition, 0 warnings. Successfully created package '...\out\Contoso.Invoices.Activities.1.0.0-preview.1.nupkg'. A problem fails the pack with a VXMAN, VXDSN or VXPKG code, the activity concerned and the fix. See Reference. Try it in Studio# In Studio, open the Package Manager (Ctrl + P) and select Settings. Under Add a source, enter a name and the full path of the out folder, then select Add. Select Trusted for the source. Open All packages > Browse, select your source, select Contoso.Invoices.Activities, and install it. Turn on Include prerelease if the package does not appear. Open the Activities panel. You should see the Invoices category with the sample activities, including Say Hello and Use Greeter. Drop Say Hello into a workflow, set Name to "World", write Greeting to a variable and log it. Run the workflow. You should see Hello, World!. See Manage packages for the Package Manager and Publish and install for getting the package to Robots. Add a dependency# To use a third-party library, add a PackageReference to both projects: the runtime project needs it to compile, and the package project must declare it so that it becomes a dependency of your package. The runtime project's own references are private and do not flow into the package. package/Contoso.Invoices.Activities.Package/Contoso.Invoices.Activities.Package.csprojXMLCopy<ItemGroup> <PackageReference Include="Velophex.Workflow.Sdk" Version="$(VelophexWorkflowSdkVersion)" /> <PackageReference Include="VeloPhex.ActivityPackage.Build" Version="$(VelophexActivityPackageBuildVersion)" PrivateAssets="all" /> <PackageReference Include="CsvHelper" Version="33.0.1" /> </ItemGroup> Every assembly your activities load must either ship in lib/ or come from a declared dependency. When a Robot restores your package, it restores the whole dependency closure from its package feeds, so every dependency must be available there too. Use Windows APIs# If your activities call Windows-only APIs, set <TargetFramework>net10.0-windows</TargetFramework> in both the runtime project and the package project. The runtime assembly is then packed under lib/net10.0-windows7.0/. Studio projects target net10.0-windows and can use either kind of package; a plain net10.0 project cannot use a Windows-only package. Next steps# Write activities
Create the projects
What you get
The VeloPhex versions
The samples
Pack it
Try it in Studio
Add a dependency
Use Windows APIs
Next steps