Question

I've been reading for hours about Script#, and after watching the author's speech at MIX11 decided to give it a try. To be honest, I can't say it's a been pleasure.

1) First of all, when I create a Script# Project, I'm not being asked where to place the scripts as seen elsewhere. Both tested on VS2010 and VS2012. Spanish versions.

2) I could create a basic Page Script, but I had to manually copy the generated .js files to my MVC scripts folder, probably due to error #1. Can this be automated in some way?

3) I see, under the Script# item templates, that I can add a different number of items, but the description seem a bit misleading to me. For example, it says the jQuery Page Script can be created "within a web application project associated with a specific page". I understand this can be added to a standard Web app project type, not a Script# one, am I wrong?

Now, if I add the Nugget packages (Script#, Script# HTML, Script# jQuery, Script# Knockout and so on) to my standard MVC project, the project fails to compile due to an error in Properties/AssemblyInfo.cs (specifically assembly: ComVisible and assembly: Guid attributes), so I guess adding those packages are somewhat corrupting the standard references. I've not been able to spot the error so the project becomes unusable indeed. Glad I did it on a test project. :)

So, in order to summarize into a question:

Can someone explain the different items that can be created with Script#, in what project types should they be created, and what are the requirements?

As a side note, my goal was to use Script# to generate my Knockout viewmodels which I'm using extensively. My first try didn't produce any script, that's why I started looking into where should this classes be created.

Thanks in advance, any tutorial URL would appreciated. The ones I found seem outdated by now.

Was it helpful?

Solution

I'll try to answer the questions...

I am working on the updated intro doc - there have been a number of recent changes in the product that will hopefully streamline things, and they're ready now, so that unblocks things. For a short while in the interim, you'll need to build the repository (which should be fairly simple). See the instructions at https://github.com/nikhilk/scriptsharp/wiki/Building,-Installing-and-Testing ... this is simply to pick up the latest and greatest which directly helps in step #4 below.

Once you have built and installed the resulting vsix (and set up a local nuget package source pointing to your local build)...

  1. Start with one of the project templates - eg. the jQuery App one.
  2. Any script# nuget packages and script# items go into the script# project (not web project)
  3. Add your code in there.
  4. Add your web project, and add a project-to-project reference from your web project to the script# project.

The generated scripts will be deployed into the Scripts folder within your web application automatically upon successful compilation.

I also recommend checking out the samples present in the github repository - you should be able to open any of the sample solutions in VS and check out how they're setup, the packages they use etc.

There is some good feedback between the lines of your questions. I'd love to see some of the pain points/confusion raised as issues, so they can be better tracked. Even better would be if you'd like to help improve the project over on github (https://github.com/nikhilk/scriptsharp).

Hope this helps, and thanks for the patience!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top