Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Script# and compiler problems

I've just come across a pretty strange problem with VS2010 and Script#, which most of the time I am able to re-create.

In my simple scenario I have 2 projects in my solution; a standard Asp.Net MVC2 Web Application, and a Script# jQuery Class Library. I created a static class (attributed with [Imported]) with a static method on it, the intention being that I can map this class in code to an external Javascript library, as described in the documentation.

However, it seems that whenever I decorate such a class with [IgnoreNamespace] to achieve this goal, the project stops successfully compiling but doesn't give me any feedback as to why it's failing (no errors in the error window, for example). It's not easy to get rid of either, as Visual Studio seems to get into a permanent state of not build failure; removing the classes and project files doesn't solve it, nor restarting visual studio. The only way I can get VS to build the project successfully is to delete the project entirely, create a new one then add the files back in, which is annoying to say the least.

With a verbose build output setting, I get the following:

Target "AfterCompile" in file "C:\Program Files (x86)\ScriptSharp\v1.0\ScriptSharp.targets" from project "e:\project\local\ScriptSharpDemo\Scripts\Scripts.csproj" (target "Compile" depends on it): Task "ScriptCompilerTask" Done executing task "ScriptCompilerTask" -- FAILED. Done building target "AfterCompile" in project "Scripts.csproj" -- FAILED.

.. which doesn't tell me whole lot.

There have been a couple of times where I have managed to create this type of class and then successfully build, but mostly I can reproduce this problem pretty reliably.

At this point I'm inclined to think that the bug lies with Script#, but would just like to have that confirmed, and to find a possible work around if there is one.

like image 261
Steve Hobbs Avatar asked Oct 14 '10 16:10

Steve Hobbs


People also ask

Whats is a script?

A screenplay, or script, is a written work by screenwriters for a film, television show, or video game (as opposed to a stage play). A screenplay written for television is also known as a teleplay. Screenplays can be original works or adaptations from existing pieces of writing.

What is script example?

Script is defined as the written words of a play, movie or show, or a standard message to deliver on the phone or in person. An example of a script is the screenplay for the movie Chinatown. An example of a script is the greeting which is spoken when making phone calls for a call center.

Is script short for prescription?

Script: An informal colloquial term for a prescription. Derived from prescription by removing both its beginning and ending to save a little bit of time and effort.

What is script in grammar?

1. countable noun. The script of a play, film, or television programme is the written version of it. Jenny's writing a film script. Synonyms: text, lines, words, book More Synonyms of script.


1 Answers

Just in case anyone is having a similar issue, I've found the cause of the problem.

When adding a class using this method, or copying in a file from another project for use within Script#, this causes a reference to System.dll to be added to the project. This (understandably) causes the project to stop compiling without error.

It would be nice to have a warning about this or for Script# to somehow detect when this situation occurs and/or create a new template for when I use 'Add class' or import a file, but it is just a convenience issue and at least now I can painlessly get my project compiling again just by removing this reference.

like image 176
Steve Hobbs Avatar answered Oct 11 '22 19:10

Steve Hobbs