Skip to content

Instantly share code, notes, and snippets.

@haruair
Last active October 19, 2017 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save haruair/5a6e43fd6ca1da5ed9a8d51e7b400835 to your computer and use it in GitHub Desktop.
Save haruair/5a6e43fd6ca1da5ed9a8d51e7b400835 to your computer and use it in GitHub Desktop.
dotnet core project
mkdir helloworld && cd helloworld
echo "# HelloWorld" > README.md
dotnet new sln -n HelloWorld
mkdir src test
dotnet new angular --output src/HelloWorld.WebApp --name HelloWorld.WebApp
dotnet new xunit --output test/HelloWorld.WebApp.Tests --name HelloWorld.WebApp.Tests
cd test/HelloWorld.WebApp.Tests
dotnet add reference ../../src/HelloWorld.WebApp/HelloWorld.WebApp.csproj
cd ../..
# the namespace is something weird
# `.` is converted to underscore so manually fix it for the time being
find src -type f -name "*.cs*" -exec sed -i '' 's/HelloWorld_WebApp/HelloWorld.WebApp/g' {} +
dotnet sln add src/HelloWorld.WebApp/HelloWorld.WebApp.csproj
dotnet sln add test/HelloWorld.WebApp.Tests/HelloWorld.WebApp.Tests.csproj
cd src/HelloWorld.WebApp
dotnet restore
npm install
dotnet run
@haruair
Copy link
Author

haruair commented Oct 2, 2017

If you have an error on testing such as below, you need to increase open file limit via ulimit -n 4096.

No test is available in ~/helloworld/test/HelloWorld.WebApp.Tests/bin/Debug/netcoreapp2.0/HelloWorld.WebApp.Tests.dll.
Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again.

It usually happened when you watch the files via webpack.

@haruair
Copy link
Author

haruair commented Oct 3, 2017

dotnet publish -c Release -r osx.10.12-x64 --self-contained

@haruair
Copy link
Author

haruair commented Oct 19, 2017

Note...

mkdir haruair-simple && cd haruair-simple
echo "# Haruair" > README.md

dotnet new sln -n HaruairSimple
mkdir src test

dotnet new reactredux --output src/HaruairSimple.WebApp --name HaruairSimple.WebApp
dotnet new classlib --output src/HaruairSimple --name HaruairSimple
dotnet new xunit --output test/HaruairSimple.WebApp.Tests --name HaruairSimple.WebApp.Tests

cd src/HaruairSimple.WebApp
dotnet add reference ../../src/HaruairSimple/HaruairSimple.csproj
cd ../..

cd test/HaruairSimple.WebApp.Tests
dotnet add reference ../../src/HaruairSimple.WebApp/HaruairSimple.WebApp.csproj
cd ../..

# the namespace is something weird
# `.` is converted to underscore so manually fix it for the time being
find src -type f -name "*.cs*" -exec sed -i '' 's/HaruairSimple_WebApp/HaruairSimple.WebApp/g' {} +

dotnet sln add src/HaruairSimple.WebApp/HaruairSimple.WebApp.csproj
dotnet sln add src/HaruairSimple/HaruairSimple.csproj
dotnet sln add test/HaruairSimple.WebApp.Tests/HaruairSimple.WebApp.Tests.csproj
cd src/HaruairSimple.WebApp
dotnet restore
npm install
dotnet run

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment