nikhilk / scriptsharp

Script# Project - a C# to JavaScript compiler, to power your HTML5 and Node.js web development.
http://scriptsharp.com
Other
658 stars 182 forks source link

New Guy #403

Closed edjohn1987 closed 11 years ago

edjohn1987 commented 11 years ago

Hey

I'm new to using Script#. Can you provide a simple start up guide to a sample project say, "FishTank".

theoutlander commented 11 years ago

I think @nikhilk has been busy, but the plan has been to create docs. I have a basic getting started with the development branch here: https://github.com/theoutlander/scriptsharp/wiki/Using-the-development-branch. If you have specific quesitons, I can try to write something up in my repo.

theoutlander commented 11 years ago

@edjohn1987 - Did you get a chance to play with S#?

edjohn1987 commented 11 years ago

Yes, but not to the extent of a fully fledge application. I have compiled some codes into JavaScript where currently, I am taking the compiled codes and implementing in another seperate project.

What I want is to be able to work with the compiled codes within the same project. Right now I am having trouble setting/troubleshooting the errors to rectify all the references/dependencies.

Date: Wed, 20 Nov 2013 12:12:15 -0800 From: notifications@github.com To: scriptsharp@noreply.github.com CC: ed_john1987@hotmail.com Subject: Re: [scriptsharp] New Guy (#403)

@edjohn1987 - Did you get a chance to play with S#?

¡ª Reply to this email directly or view it on GitHub.

theoutlander commented 11 years ago

Thanks for the update. I can try to work on a quick start this weekend if I get a chance. What would you like to see specifically?

edjohn1987 commented 11 years ago

A simple web application project with:

C#:

html:

The idea here is to combine both the .cs compilation with web page under 1 (roof) project. The current HTML5 project compiles a class.cs into class.js. A secondary project must be created as output type to utilise the .js file. It is this secondary project that I am having difficulties setting the configs.

May I also know what Visual Studio version and build did you use to create this project.

Date: Wed, 20 Nov 2013 17:53:26 -0800 From: notifications@github.com To: scriptsharp@noreply.github.com CC: ed_john1987@hotmail.com Subject: Re: [scriptsharp] New Guy (#403)

Thanks for the update. I can try to work on a quick start this weekend if I get a chance. What would you like to see specifically?

¡ª Reply to this email directly or view it on GitHub.

nikhilk commented 11 years ago

A comment about solution/project structure...

A script# project is a c# class library project, so it doesn't have a "Run" semantic, which would be the pre-requisite to doing things like hosting both c# source to compile to script, and the container html page to include the script into to be able to execute within a browser (or if you're in the nodejs world, execute node with). The way to have enabled that would have been to write a custom project flavor with a fair bit of VS extensibility work to add this semantic.

Alternatively there might be an argument to have the c# to compile to script nested somewhere within a web project. That would have required some notion of nested projects, which VS has never fully supported, as far as I know.

Net result - you create two projects for the html. You can of course do tricks like include html in your script library project and mark it as content, so it gets copied over to the bin directory. You can then either load the html file into the browser, or run a local web server rooted at the bin directory independently of script#, and the project system.

So to simplify the all-in VS scenario, simply create the script# project and the web project in the solution and add a reference to the script# project within the web project. You'll need to add the ScriptSharp.Runtime nuget package to your web project - this adds msbuild steps to copy generated javascript into the web project from the script# project at build time.

I'll try to get something written up and coordinate with @theoutlander (target during the upcoming thanksgiving break).

theoutlander commented 11 years ago

@edjohn1987 - @nikhilk addressed your issue regarding two projects above. As for tutorials, I'm starting to work on something and will try to address areas you're interested in. Here's a first pass with a Hello World application.

You can use VS 2010 / 2012 / 2013 including Express versions.