Bjornej / GruntLauncher

A vspackage that adds the possibility to launch Grunt tasks
MIT License
40 stars 11 forks source link

Object reference not set to an instance of an object. #5

Closed gregpakes closed 11 years ago

gregpakes commented 11 years ago

When I right-click "Grunt" (no other options available), I just get "Object reference not set to an instance of an object." in the output window.

gruntfile.js

module.exports = function (grunt) {
    "use strict";

    // load all grunt tasks

    grunt.initConfig({

        less: {
            development: {
                options: {
                  paths: [
                        "path/components",
                        "path/legacy"
                    ],
                    yuicompress: false
                },
                files: {
                  "path/site.min.css": "path/site.less"
                }
            },
        },
        watch: {
            files: "path/**/*.less",
            tasks: ["less-dev"]
        }
    });

    grunt.loadNpmTasks('grunt-contrib-less');
    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.registerTask("less-dev", ["less:development"]);

};
Bjornej commented 11 years ago

I've tried your gruntfile and it works on my visual studio. Are you using VS 2012 update 3 or VS2013?

Bjornej commented 11 years ago

If that's the case I can try to update my machine and replicate the problem.

gregpakes commented 11 years ago

I tried it in visual studio 2012 update 3.

It doesn't install into 2013 for me.

Bjornej commented 11 years ago

Are you using Professional, Premium or Ultimate? Also, has the plugin ever worked for you or it's this specific file?

gregpakes commented 11 years ago

I am using ultimate. I've never used the plugin before so it has never worked for me.

Bjornej commented 11 years ago

I'm using the exact same version, ultimate with update 3. When I get home tonight I'll build you a debug version so we can try to pinpoint the problem

gregpakes commented 11 years ago

HI -

I've created a debug build myself and found the issue. When I right-click gruntfile.js the following line errors:

private string GetSourceFilePath()
{
    ...
    string filePath = prjItem.Properties.Item("FullPath").Value.ToString();
    ...
}

The reason is Properties is null.

Could it be that I'm using solution folders? I'll debug further.

gregpakes commented 11 years ago

I have solved the issue. Will submit a pull request shortly.

I have another issue now though and am wondering if you have any ideas?

I am getting this in the output window:

Executing  grunt watch

'grunt' is not recognized as an internal or external command, operable program or batch file.
Bjornej commented 11 years ago

Hi,

great for the solution. It seems that you don't have grunt-cli installed globally. You can install it by doing

npm -g install grunt-cli

from the command line.

Bjornej commented 11 years ago

Done. I've merged the pull request, rebuilt the installer and uploaded it to visual studio gallery so it should appear as an available update.

Thank you for the patience and for the help.