Getting Started - Visual Studio Professional guidance
If you have already completed the VS Code guidance please continue to the next section
Full Visual Studio licences are expensive. Unless you already have one, or are moving into writing code full time, it is instead recommend to use Visual Studio Code.
Creating the library
You can decide to write you library in either .NET Framework 4.6 or below or .NET Standard 2.2 or below. We recommend .NET Standard.
In Visual Studio (or you IDE of choice), select to create a Class Library project.
Next give it a name that uniquely describes you library:
Next create or rename the classes that you're going to need and organize them by folders as it most makes sense:
The namespaces of each class will be used to generate the menu structure in ArupCompute. We recommend keeping your namespaces aligned with the file/folder structure of your classes.
Now, we can finally add our first function/calculation/method:
public static double BasicCalc(double a, double b)
{
return a + b;
}
This is as simple as a calculation can get! But by itself it's not enough to work, we'll need to add specific ArupCompute attributes. We'll see that in the next section.
Note that the both the class and function are now marked as public
and static
, unless you know what you are doing this is how you should set up your classes and function in order to work well with AC.
Linking the ArupCompute .NET SDK
The ArupCompute .NET SDK is a library we've written to facilitate the process of writing new calculations. You'll have to download it and reference it in your project as it includes mandatory attributes you'll need to decorate your methods/classes with.
You can see all the examples below in the sample repo https://github.com/arup-group/arupcompute-sample-library.
Adding the ArupCompute NuGet Feed to Visual Studio Professional
The ArupCompute .NET SDK comes as a NuGet package that can be installed with one click, but first you need to add the ArupCompute NuGet feed to your Visual Studio installation.
- Click on Tools > Options > NuGet Package Manger > Package Sources
- Then add a new package source with the following properties
- Name:
ArupCompute
- Source:
https://pkgs.dev.azure.com/arupcomputedevops/_packaging/arupcomputedevops@Release/nuget/v3/index.json
- Name:
For how to add the feed in VS Code follow the DesignCheck guide
Adding the NuGet package to your project
You can now add the NuGet package to your project:
- Right click on the project name, then > Manage NuGet Packages...
- On the top right select the
ArupCompute
package source - Make sure you are on the "Browse" tab
- Select
Arup.Compute.DotNetSdk
and click install