Cannot create new project (VS2013 and multi-hybrid device app)

前端 未结 2 1144
谎友^
谎友^ 2020-12-06 15:54

I get the error below when I try to create a new project. I\'ve upgraded to CTP2. Error:

The expression \"\"\".Substring(0, 6)\" cannot be evaluated. Index an

2条回答
  •  悲&欢浪女
    2020-12-06 16:29

    Quite a few of our devs had to solve this one on our team, so I created a script to fix this for them after the upgrade to CTP3. It basically does what Ellen's solution does, but it does it automatically by looking up the Registry entry for the VS Extension path :)

    Create a .cmd file with the following contents:

    @echo off
    setlocal ENABLEEXTENSIONS
    echo -- Searching for MultiDeviceHybridApp Visual Studio Extension --
    set KEY_NAME=HKEY_USERS\.DEFAULT\Software\Microsoft\VisualStudio\12.0\ExtensionManager\EnabledExtensions
    set SEARCH_VALUE=MultiDeviceHybridApp
    set REG_QUERY_CMD=reg query "%KEY_NAME%" /f "%SEARCH_VALUE%"
    for /f "tokens=2*" %%a in ('%REG_QUERY_CMD% 2^>^&1^|find "REG_"') do @set RESULT_REG_VALUE=%%b
    goto find_result_%ERRORLEVEL%
    :find_result_0
    echo Found here: %RESULT_REG_VALUE%
    set PACKAGES_PATH=%RESULT_REG_VALUE%\packages
    echo Installing vs mda packages....
    echo.
    set CMD=npm -g uninstall "%PACKAGES_PATH%\vs-mda-targets"
    echo Running: %CMD%
    call %CMD%
    echo.
    set CMD=npm -g uninstall "%PACKAGES_PATH%\vs-mda"
    echo Running: %CMD%
    call %CMD%
    echo.
    set CMD=npm -g install "%PACKAGES_PATH%\vs-mda"
    echo Running: %CMD%
    call %CMD%
    echo.
    set CMD=npm -g install "%PACKAGES_PATH%\vs-mda-targets"
    echo Running: %CMD%
    call %CMD%
    echo.
    echo Done!
    goto end
    :find_result_1
    echo *** Could not find MultiDeviceHybridApp Visual Studio Extension path ***
    :end
    pause
    

    Run this file and it should uninstall and reinstall the npm packages correctly for you!

    PS. You will obviously need npm to be part of your system path.

提交回复
热议问题