Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/bin/bash
## Temporary workaround for ncurses bug (https://github.com/dotnet/corefx/issues/26966#issuecomment-367066252)
export TERM=xterm
DEMOPROJECT=MyLib
## Cleanup
rm -rf $DEMOPROJECT
## Create new c# project
dotnet new classlib -o $DEMOPROJECT
## Create new csproj file with FAKE reference
cat <<EOF > $DEMOPROJECT/$DEMOPROJECT.csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<DotNetCliToolReference Include="dotnet-fake" Version="5.0.0-beta020" />
</ItemGroup>
</Project>
EOF
## Create script file
cat <<EOF > $DEMOPROJECT/myscript.fsx
#r "paket:
nuget Fake.Core.Target //"
#load "./.fake/build.fsx/intellisense.fsx"
EOF
## Create another script script file (without `#load`)
cat <<EOF > $DEMOPROJECT/myscript-withoutload.fsx
#r "paket:
nuget Fake.Core.Target //"
EOF
echo ""
echo "CONTENT PROJECT FOLDER:"
ls -al $DEMOPROJECT
echo ""
echo "CONTENT OF CSPROJ FILE:"
cat $DEMOPROJECT/$DEMOPROJECT.csproj
echo ""
echo "CONTENT OF MYSCRIPT.FSX FILE:"
cat $DEMOPROJECT/myscript.fsx
echo ""
echo "-------------"
echo "RUNNING dotnet restore..."
cd $DEMOPROJECT && dotnet restore
cd ..
# echo "-------------"
# echo "RUNNING dotnet fake run myscript.fsx..."
# cd $DEMOPROJECT && dotnet fake -v run myscript.fsx &> ../out.log
# cd ..
## Output (as described in https://github.com/fsharp/FAKE/issues/1778#issuecomment-369119233)
##
## [...]
## Script failed with
##-> FAKE-CACHING: Could not find file './.fake/build.fsx/intellisense.fsx' in any paths searched. Searched paths:
## [""]
echo "-------------"
echo "RUNNING dotnet fake run myscript-withoutload.fsx..."
cd $DEMOPROJECT && dotnet fake -v run myscript-withoutload.fsx &> ../out2.log
cd ..
## Output:
##
## Locked version resolution written to /home/patrick/projects/dotnet-core-fake5-demos/demo1-csharp-without-paket/MyLib/.fake/myscript-withoutload.fsx/paket.lock
## /home/patrick/projects/dotnet-core-fake5-demos/demo1-csharp-without-paket/MyLib/myscript-withoutload.fsx (2,26)-(2,26): Warning FS0988: Main module of program is empty: nothing will happen when it is run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment