Git Product home page Git Product logo

Comments (15)

kytrinyx avatar kytrinyx commented on September 26, 2024

I have the same command-line bias (but I've never worked with C#). Do you know if there are any resources that talk about how that has been done elsewhere?

from csharp.

NobbZ avatar NobbZ commented on September 26, 2024

AFAIK Microsoft uses some buildfile-format called msbuild. Some googling showed up the following ressource: https://msdn.microsoft.com/en-us/library/dd576348.aspx

These files can be run from commandline using msbuild.exe on windows or xbuild (from mono) on linux and Mac OSX. At least, thats the theory.

from csharp.

jwood803 avatar jwood803 commented on September 26, 2024

I dislike MSBUILD and find it very hard to work with. :}

However, I have been playing around with FAKE which should be the solution that's needed here.

from csharp.

NobbZ avatar NobbZ commented on September 26, 2024

MSBUILD seems to have the advantage, that the msbuild-files can be opened by Visual/Xamarin Studio and monodevelop as projects for everyone who really wants that, can FAKE do this too?

from csharp.

jwood803 avatar jwood803 commented on September 26, 2024

FAKE scripts are just F# script files that can be opened in either editor. Feel free to read some on it here that has some examples to see if that will work for you.

from csharp.

NobbZ avatar NobbZ commented on September 26, 2024

So using FAKE would pull in F# as another dependency for trying out C#? XBuild is part of mono while F# has to be installed additionally.

from csharp.

NobbZ avatar NobbZ commented on September 26, 2024

Has there been any progression on this or a decission at least?

from csharp.

bressain avatar bressain commented on September 26, 2024

I haven't had a chance to look at it unfortunately, but it's an interesting problem.

While Xamarin studio may feel heavy, it's probably the easiest way to get Mono installed. And because of how .Net currently requires proj files, it might be easier to have an IDE manage that.

If someone wants to take a shot at this before I can look into it, we take pull requests :-D

from csharp.

ErikSchierboom avatar ErikSchierboom commented on September 26, 2024

I have been looking at various build systems lately, and MSBuild is not the best option to do cross-platform building. FAKE is a nice alternative, but it requires you to write the configuration file in F#. However, there is also another library named CAKE that allows the configuration to be specified in a C# DSL.

Using FAKE or CAKE would allow the tests to be run from the command-line, either on Windows, Mac OS X or Linux. However, FAKE or CAKE can only build solution (.sln) or (.csproj) files, not individual C# files. At the moment, we don't supply any of those, so users would have to create them first. Is there a reason why we don't supply a solution file? If this is not desirable, I probably could create some code that uses Roslyn to dynamically create a solution/project. Should we go this route, I could also create solutions/projects for the files in a single folder, which would allow us to run tests for a single, specific exercise.

I'm very interested in your thoughts on this subject.

from csharp.

ErikSchierboom avatar ErikSchierboom commented on September 26, 2024

I managed to get something working for F#: exercism/fsharp#55
I'll be looking into getting this to working for C# too.

from csharp.

ErikSchierboom avatar ErikSchierboom commented on September 26, 2024

I have a FAKE build script that currently builds all our examples. It would be easy to extend this to a general script with which you can run all or one exercise.

The problem is that at the moment, it is not possible to a language track to have additional scripts automatically be fetched. For context, see this comment by @kytrinyx: exercism/fsharp#32 (comment)

When support for this is added, I'll make sure we get a command-line build/test script for the C# track (and the F# track too).

from csharp.

canweriotnow avatar canweriotnow commented on September 26, 2024

I think #146 will help with this... using .NET Core and VS Code makes it easy to not only build and run C# projects from the dotnet CLI, but VS Code adds extensive build support for Make, Rake, Fake, and Cake.

from csharp.

ErikSchierboom avatar ErikSchierboom commented on September 26, 2024

It definitely will! See also #138

from csharp.

petertseng avatar petertseng commented on September 26, 2024

I will not mind sharing the exact script I used to test on Linux

#!/bin/sh

set -e

if [ $# -eq 0 ]; then
  srcfile=$(ls -1 *.cs | grep -v Test)
  if [ -z "$srcfile" ]; then
    echo "found no .cs files, run in a directory with one, or specify one."
    echo "usage: $0 [srcfile [testfile]]"
    exit 1
  fi
fi

if [ $# -lt 2 ]; then
  testfile=*Test.cs
  testdll="$(echo $testfile | cut -d. -f1).dll"
else
  testfile=$2
  testdll="$(echo "$testfile" | cut -d. -f1).dll"
fi

srcdll="$(echo "$srcfile" | cut -d. -f1).dll"
nunit=/usr/lib/cli/nunit.framework-2.6.3/nunit.framework.dll

mcs -t:library $srcfile
mcs -t:library -r:$nunit,$srcdll $testfile
nunit-console --noxml $testdll
rm $srcdll $testdll

will be good to see dotnet test improve on this.

from csharp.

ErikSchierboom avatar ErikSchierboom commented on September 26, 2024

This issue will be taken care of when #200 completes.

from csharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.