locked
Parse error - file doesn't exist (when it does) RRS feed

  • Question

  • I am getting this error in PS:

    /-u/DimaWeb/Account/RegisterExternalLogin.aspx(1): error ASPPARSE: The file '/-u/Site.master' does not exist.

    I am trying to compile a Visual Studio 2017 Web Forms project (I have done it before so I know it can be done) using the following:

    PS C:\> $aspnetCompiler = (Join-Path $env:windir 'Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler')>> & $aspnetCompiler -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C:\DimaWebCompiled_test"

    DimaWeb is the folder in Documents where I house my VS project files, and DimaWebCompiled_test is a folder on my C drive to store my project's compiled files. All files need to be compiled for the project to be compiled. I don't understand the error. I do not have a file called RegisterExternalLogin.aspx(1) in my Account folder, but I do have a file called RegisterExternalLogin.aspx in my Account folder. I also have a file called Site.master in my project, though I never use it.

    What should I be doing, please, that I am not doing?

    Thanks!

    Wednesday, March 6, 2019 2:37 PM

Answers

  • What does "not like" mean in technical language.  I don't like brussels sprouts but that has nothing to do with my path.

    You have to slow down and understand what is happening.

    Use this Test-Path

    if (!(Test-Path 'c:\test')) {
        Write-Host 'PATH NOT FOUND'
        pause
    }


    \_(ツ)_/

    • Marked as answer by jrv Wednesday, March 6, 2019 10:23 PM
    Wednesday, March 6, 2019 9:39 PM

All replies

  • Try to provide the path without your weird construct with Join-Path ... use the complete literal path enclosed in quotes.  .... just to test.

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Wednesday, March 6, 2019 2:55 PM
  • I would recommend posting here: http://forums.asp.net

    They will show you an easier way to do this.


    \_(ツ)_/

    Wednesday, March 6, 2019 3:30 PM
  • Thanks NOfH_666 for your reply.

    I have tried this (if that is what you mean?):

    $aspnetCompiler = ('Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler')
    & $aspnetCompiler -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C:\DimaWebCompiled_test"

    and get this error:

    & : The module 'Microsoft.NET' could not be loaded. For more information, run 'Import-Module Microsoft.NET'. At line:2 char:3 + & $aspnetCompiler -p "C:\Users\Steve\Documents\Visual Studio 2017\Dim ... + ~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Microsoft.NET\F...aspnet_compiler:String) [], CommandNotFoundException + FullyQualifiedErrorId : CouldNotAutoLoadModule

    and when I try Import-Module as suggested in the error, I get:

    PS C:\> Import-Module Microsoft.NET
    Import-Module : The specified module 'Microsoft.NET' was not loaded because no valid module file was found in any
    module directory.
    At line:1 char:1
    + Import-Module Microsoft.NET
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : ResourceUnavailable: (Microsoft.NET:String) [Import-Module], FileNotFoundException
        + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
    Thanks again
    Wednesday, March 6, 2019 4:50 PM
  • Contributors to asp.net have, in the past, suggested I use Build from within VS itself. I have found PS and Cmd Prompt to be usually more stable ways of compiling.

    Besides, I have done it often in Cmd Prompt and a couple of times in PS, so I know it can be done - just not come across that error before.

     
    Wednesday, March 6, 2019 4:53 PM
  • Please try to understand, you issue is not with scripting.  It is with the use of an external utility.  Posting in the correct forum will help you to resolve these issues.


    \_(ツ)_/

    Wednesday, March 6, 2019 5:04 PM
  • Thanks, JRV

    I will try posting there again!

    But waiting for any sugegstions BOfH_666 may have.

    Thanks again

    Wednesday, March 6, 2019 5:11 PM
  • You can also post in the Visual Studio forum since you are trying to compile a VS project.  This should likely be done with MSBuild as you would have more control and better messages.

    Note that many Net utilizes and VS may require opening a VS prompt which loads the environment variables and updates the path.  Those items are likely why files are missing.


    \_(ツ)_/

    Wednesday, March 6, 2019 5:15 PM
  • I will do that now, JRV - thank you.
    Wednesday, March 6, 2019 5:23 PM
  • I have tried this (if that is what you mean?):

    No ... it is not.  What is the full path to the executable you're trying to run?  I meant something like this:
    "C:\the\full\path\to\your\executable.exe" -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C:\DimaWebCompiled_test"



    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Wednesday, March 6, 2019 5:47 PM
  • I have this BOfh_666

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe" -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C:\DimaWebCompiled_test"

    Don't I need this anywhere?

    $aspnetCompiler =
    Wednesday, March 6, 2019 6:53 PM
  • That won't work:

    ${env:ProgramFiles(x86)}\'Microsoft Visual Studio'\2017\Community\Common7\IDE\devenv.exe -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v -u "C:\DimaWebCompiled_test"
    


    \_(ツ)_/

    Wednesday, March 6, 2019 7:09 PM
  • This would be even better:

    $devenv = 'C:\Program Files (x86)Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe'
    Start-Process -FilePath $devenv -ArgumentList '-p','C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb','-v -u','C:\DimaWebCompiled_test'
    


    \_(ツ)_/

    Wednesday, March 6, 2019 7:12 PM
  • Don't I need this anywhere?
    How am I supposed to know that? I don't have access to your system - you have. I'm not using Visual Studio 2017 - you do. Did you try the command? What happend?

    Live long and prosper!

    (79,108,97,102|%{[char]$_})-join''

    Wednesday, March 6, 2019 7:13 PM
  • Error:

    At line:1 char:25
    + ... mFiles(x86)}\'Microsoft Visual Studio'\2017\Community\Common7\IDE\dev ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Unexpected token '\'Microsoft Visual Studio'\2017\Community\Common7\IDE\devenv.exe' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken

    Wednesday, March 6, 2019 7:52 PM
  • Error:

    Start-Process : This command cannot be run due to the error: The system cannot find the file specified.
    At line:1 char:1
    + Start-Process -FilePath $devenv -ArgumentList '-p','C:\Users\Steve\Do ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException
        + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

    Wednesday, March 6, 2019 7:53 PM
  • Error:

    "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe" -p "C:\Users\Steve\Docume
    nts\Visual Studio 2017\DimaWeb" -v /-u "C:\DimaWebCompiled_test"
    At line:1 char:88
    + ... osoft Visual Studio\2017\Community\Common7\IDE\devenv.exe" -p "C:\Use ...
    +                                                                ~~
    Unexpected token '-p' in expression or statement.
    At line:1 char:91
    + ... env.exe" -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v  ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Unexpected token '"C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb"' in expression or statement.
    At line:1 char:145
    + ... " -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C: ...
    +                                                                ~~
    Unexpected token '-v' in expression or statement.
    At line:1 char:148
    + ...  "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C:\Dim ...
    +                                                               ~~~
    Unexpected token '/-u' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken

    Wednesday, March 6, 2019 7:54 PM
  • I will try once more.

    $devenv = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe'
    if(!Test-Path $devenv){exit} $arglist = @( '-v', '-p C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb', '-u C:\DimaWebCompiled_test' ) Start-Process -FilePath $devenv -ArgumentList $arglist

    I don't have the community edition and the build environment is not installed currently so you will have to sort out the switches you are using.

    This is why I posted that you should post in the VS forum.


    \_(ツ)_/



    • Edited by jrv Wednesday, March 6, 2019 8:50 PM
    Wednesday, March 6, 2019 8:48 PM
  • It didn't like your Test-Path and when I replaced it with Join-Path it didn't like that either.

    I get this:

    I am not sure what that refers to.

    I removed the 2 Site.master files from my project folder and ran the script I did at the beginning, namely

    $aspnetCompiler = (Join-Path $env:windir 'Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler')
    & $aspnetCompiler -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v /-u "C:\DimaWebCompiled_test"

    and I still get the same error about missing Site.master. In other words, I get the same error whether Site.master is present in the project folder or not.

    Yes, I have posted a message of help to the VS forum.

    Thanks again for all your help and time.

    Wednesday, March 6, 2019 9:28 PM
  • What does "not like" mean in technical language.  I don't like brussels sprouts but that has nothing to do with my path.

    You have to slow down and understand what is happening.

    Use this Test-Path

    if (!(Test-Path 'c:\test')) {
        Write-Host 'PATH NOT FOUND'
        pause
    }


    \_(ツ)_/

    • Marked as answer by jrv Wednesday, March 6, 2019 10:23 PM
    Wednesday, March 6, 2019 9:39 PM
  • $devenv = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe'
    if (!(Test-Path $devenv )) {
        Write-Host 'PATH NOT FOUND' $devenv
        pause
    }
    if (!(Test-Path 'C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb')) {
        Write-Host 'PATH NOT FOUND' 'C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb'
        pause
    }
    
    $arglist = @(
        '-v',
        '-p C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb',
        '-u C:\DimaWebCompiled_test'
    )
    Start-Process -FilePath $devenv -ArgumentList $arglist


    \_(ツ)_/



    • Edited by jrv Wednesday, March 6, 2019 10:23 PM
    Wednesday, March 6, 2019 9:41 PM
  • PS C:\> if (!(Test-Path 'c:\test')) {
    >>     Write-Host 'PATH NOT FOUND'
    >>     pause
    >> }
    PATH NOT FOUND
    Press Enter to continue...:

    Wednesday, March 6, 2019 10:17 PM
  • >> Start-Process -FilePath $devenv -ArgumentList $arglist
    PATH NOT FOUND C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe
    Press Enter to continue...:
    PS C:\>

    Plus the unknown switch 'v' dialogue box pops up as before.

    It refers to an sln file. There is an sln file in the folder DimaWeb, but not housed in the same folder as my aspx files, images, etc. That's how VS arranged it, not me.

    Wednesday, March 6, 2019 10:21 PM
  • Sorry I missed that use this.

    if (!(Test-Path $devenv )) {
        Write-Host 'PATH NOT FOUND' $devenv
        pause
    }


    \_(ツ)_/

    Wednesday, March 6, 2019 10:24 PM
  • This will eliminate the "v"  error:

    $devenv = 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\devenv.exe'
    if (!(Test-Path $devenv)) {
        Write-Host 'PATH NOT FOUND' $devenv
    }elseif(!(Test-Path 'C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb')) {
        Write-Host 'PATH NOT FOUND' 'C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb'
        pause
    }else{
        $arglist = @(
            '-v',
            '-p C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb',
            '-u C:\DimaWebCompiled_test'
        )
        Start-Process -FilePath $devenv -ArgumentList $arglist
    }


    \_(ツ)_/




    • Edited by jrv Wednesday, March 6, 2019 10:28 PM
    Wednesday, March 6, 2019 10:27 PM
  • That pop-up box still pops up

    Wednesday, March 6, 2019 10:34 PM
  • In the DimaWeb folder (Documents / VS 2017)

    Wednesday, March 6, 2019 10:36 PM
  • The command switch is just the wrong switch. 

    What is it supposed to do?


    \_(ツ)_/

    Wednesday, March 6, 2019 10:39 PM
  • Actually move the -v to the end.

    I can find no documentation for devenv that uses your switches.


    \_(ツ)_/

    Wednesday, March 6, 2019 10:40 PM
  • From memory, I think it refers to virtual drive. The asp compiler script was used originally in Command Prompt and people at PowerShell have just customised it. I can't seem to find any MS-DOS or cmd prompt forums to ask.
    Wednesday, March 6, 2019 10:45 PM
  • Many thanks for looking, anyway. I am grateful.

    I will call it a day and try to do it via VS itself - and see what they think from the message I posted earlier.

    Wednesday, March 6, 2019 10:46 PM
  • Many thanks for looking, anyway. I am grateful.

    I will call it a day and try to do it via VS itself - and see what they think from the message I posted earlier.

    As I posted more than once, post in the VS forum.  It is their tool.  The old devenv was much different from the latest one so you may have many things wrong.


    \_(ツ)_/

    Wednesday, March 6, 2019 10:57 PM