To install this tool, in cmd
run the following:
C:\> dotnet tool install --global msharp-build
Or if you already have it, run:
C:\> dotnet tool update --global msharp-build
To create a new M# project, run the following command:
C:\Projects\> msharp-build /new /n:"ProjectName"
At this point, the template repository will be downloaded from here, and the placeholders will be replaced with the name provided in the /n:
parameter.
/t:myUrl
Allows you to provide your own project template repository url (which must be publically accessible) instead of the default. Note thatmyUrl
should end with/archive/master.zip
to be downloadable./o:myPath
Specifies the output folder in which to create the new project. If not set, it defaults to the current directory. Please note that a directory with the name of the project will be created inside the output directory./p:portNumber
Allows you to set a new port number for the project. Without this parameter, a random port number is used.
C:\Projects\> msharp-build /new-ms /n:"ProjectName"
This will use the template from here.
This command should be executed from inside the microservice solution folder, where it can find Hub as a sibling service directory. Placeholders in the template will be replaced with the parameters or the hub's settings.
/t:myUrl
like the above./o:myPath
like the above./p:portNumber
Allows you to set a new port number for the microservice. Without this parameter, tries to find the next port number from the hub's services. If both of the parameter and hub's services are not found, random port number is used.
To build an existing M# project, run the following command:
C:\Projects\MyProject\> msharp-build
You need to do this only once, to ensure your development environment is prepared, with all necessary tools installed:
C:\>msharp-build /tools
There are many Olive components which can have interdependencies. Unfortunately Visual Studio can sometimes not figure out the right way to update the packages when you want to update your project nugets. To solve this problem, you can run the following command:
C:\>msharp-build /update-nuget
It will query the nuget.org server to find the latest version of all Olive and msharp nuget packages used in any of your projects (Model, UI, Domain, and Website). It will then directly replace the csproj
files to use the latest versions. This will bypass the dependency checks. When you build the project, the packages will be restored automatically.