mocha-dotnet/mocha-dotnet-new

60 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# mocha-dotnet-new
# creates a new DotNet project and adds all the references needed to use
# Mocha from within .NET
MOCHA_DOTNET_LIBRARIES_PATH=/usr/lib/mocha/dotnet
MOCHA_MOCHA_LIBRARIES_PATH=/home/beckermj/Documents/Projects/mochapowered/mocha-dotnet/mocha-common/mocha-common/output
dotnet new console
# dotnet add reference /usr/lib/mocha/dotnet/Mocha.Core.dll
# dotnet add reference /usr/lib/mocha/dotnet/MBS.Core.dll
# link a reference to mocha system libraries
ln -s $MOCHA_MOCHA_LIBRARIES_PATH system
# since we cannot 'dotnet add reference', do it manually - it still works
FILE=*.csproj
ROOT_NAMESPACE=MochaTest1
echo """
<Project Sdk=\"Microsoft.NET.Sdk\">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>$ROOT_NAMESPACE</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Reference Include=\"MBS.Core\">
<HintPath>$MOCHA_DOTNET_LIBRARIES_PATH/MBS.Core.dll</HintPath>
</Reference>
<Reference Include=\"Mocha.Core\">
<HintPath>$MOCHA_DOTNET_LIBRARIES_PATH/Mocha.Core.dll</HintPath>
</Reference>
<Reference Include=\"Mocha.Plugins.Libraries.McxMini\">
<HintPath>$MOCHA_DOTNET_LIBRARIES_PATH/Mocha.Plugins.Libraries.McxMini.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include=\"system\\net.alcetech.Mocha.System.mcl\" />
</ItemGroup>
</Project>
""" > $FILE
MOCHA_SHARE=/usr/share/mocha
cp $MOCHA_SHARE/examples/mocha-dotnet-new/Program.cs Program.cs
echo ""
echo "Next steps:"
echo ""
echo "1. Edit the Program.cs file to make changes, or open the folder in"
echo " your favorite IDE."
echo ""
echo "2. Type 'dotnet run' to see the program in action."
echo ""