locked
Error ASPPARSE: The file '/-u/Site.master' does not exist. RRS feed

  • Question

  • User-1793215261 posted

    Hello

    While compiling my VS2017 Web Forms project via PowerShell 5, as I normally would, I get the following error which is preventing the project from being compiled:

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

    The Power Shell code I am using to compile my project is:

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

    This script usually works which is why I continue to use it. 

    DimaWeb is the name of my VS2017 Web Forms project and my various files and folders relating to the project are housed in that folder which is in a folder in Documents. I would like to compile that DimaWeb folder and save the compiled files inside the DimaWebCompiled_test folder on my C drive before uploading those files to my Web hosting service.

    I do not understand the error or how to correct it. I have a aspx file called RegisterExternalLogin.aspx in my VS2017 project (it is in my Account folder in Solution Explorer), but not RegisterExternalLogin.aspx(1). I also have a file called Site.master which, as far as I know, I do not use.

    I am not sure what it means 'parser' error, but how do I correct it, please? I originally posted this question on the MSDN forum, but they have referred me here.

    Thanks

    Monday, March 11, 2019 11:48 PM

All replies

  • User283571144 posted

    Hi Bluenose,

    According to the error message, it seems you don't build your application before compiling it. As far as I know,  the AspNetCompiler was looking for the types in the bin folder. 

    I suggest you could try to build it firstly and then run the command it will work well.

    Below is the test result image:

    Best Regards,

    Brando

    Tuesday, March 12, 2019 8:59 AM
  • User-1793215261 posted

    Thanks, Bruno, for your reply.

    I have Ctrl + Shift + B to build my Solution and get the following:

    Warning: Unable to update auto-refresh reference 'aspnet.scriptmanager.jquery.dll'. Cannot find assembly 'C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb\Projects\DimaFinal\packages\AspNet.ScriptManager.jQuery.1.8.2\lib\net40\AspNet.ScriptManager.jQuery.dll'.
    Validating Web Site
    Building directory '/Account/'.
    Building directory '/'.
    Building directory '/js/'.
    Building directory '/Scripts/'.
    
    Validation Complete

    The warning is a bit strange because I can see 

    AspNet.ScriptManager.jQuery.1.8.2

    in my Packages.config file (pity I can't show you via a screenshot here). Anyway, the build shows 'Validation Complete'. Do I now save the project to my usual 'DimaWeb' folder in Documents, and then try to compile it in PowerShell?

    Thank you again.

    Tuesday, March 12, 2019 6:12 PM
  • User753101303 posted

    Hi,

    What if you try -v / -u rather than -v /-u

    (note the extra space to use -v with / and then -u rather than -v with the /-u virtual path)

    Tuesday, March 12, 2019 6:56 PM
  • User-1793215261 posted

    Thanks, Patrice

    With the extra space, I still get this:

    PS C:\WINDOWS\system32> cd\
    PS C:\> $aspnetCompiler = (Join-Path $env:windir 'Microsoft.NET\Framework64\v4.0.30319\aspnet_compiler.exe')
    >> & $aspnetCompiler -p "C:\Users\Steve\Documents\Visual Studio 2017\DimaWeb" -v / -u "C:\DimaWebCompiled_test"
    Microsoft (R) ASP.NET Compilation Tool version 4.7.3056.0
    Utility to precompile an ASP.NET application
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    /DimaWeb/Account/RegisterExternalLogin.aspx(1): error ASPPARSE: The file '/Site.master' does not exist.
    PS C:\>

    Thanks again.

    Tuesday, March 12, 2019 7:02 PM
  • User283571144 posted

    Hi Bluenose,

    According to your description, I suggest you could try to set the site.master file property's  copy to output directory to copy aways.

    Image as below:

    Best Regards,

    Brando

    Thursday, March 14, 2019 2:35 AM
  • User-1793215261 posted

    Thanks, Brando

    When I click on the Site.master file in Solution Explorer with the Properties window open, I can only see this:

    Misc

    File name: Site.master
    Full path: Path to Site.master in my project folder (the path is correct which is why is it odd that I get that 'file not found' compilation error.

    Nothing else appears in that Properties window - I can't see 'copy to output directory'. In your screenshot, you have Advanced and Misc. I do not have that Advanced option, apparently.

    If I right-click on Site.master, I see only these items:

    Open
    Opem with...
    Scope to this
    New Solution EXplorer View
    View Code
    View Designer
    View Markup
    View Component Designer
    Add Content Page
    Build Page
    Exclude From Project
    Cut
    Copy
    Delete
    Rename

    Thanks again.

    Sunday, March 17, 2019 1:59 PM
  • User283571144 posted

    Hi Bluenose,

    Could you please tell me the version of your VS2017?  

    Are all the files inside the project not contain the property?

    Have you tried the hot key with ALT+ENTER?

    Below is my right click popup window, my visual studio version is 2017 15.9.3.

    Best Regards,

    Brando

    Monday, March 18, 2019 5:27 AM
  • User-1793215261 posted

    Hello Bruno

    Yes:

    Microsoft Visual Studio Community 2017
    Version 15.9.8
    VisualStudio.15.Release/15.9.8+28307.481
    Microsoft .NET Framework
    Version 4.7.03056

    Installed Version: Community

    When I press ALT + Enter, I do not have a Properties item at the end of the menu that pops up (the last item is Rename), but the Properties window pane opens up in the bottom-right hand corner of the VS application and I see the following:

    MISC:

    File Name: Site.master

    Path: Path to my project folder

    If I right-click on an image file in my images folder in Solution Explorer, I do not see Properties item on the drop-down menu, but I get the Properties window again in the bottom-right of the VS application:

    MISC  

    File Name: image-slider.jpg

    Path: Path to my images folder on my PC.

    Thanks

    Monday, March 18, 2019 8:31 AM
  • User753101303 posted

    Have a look maybe at your RegisterExternalLogin.aspx to see how the reference to this master page looks like? I would perhaps get rid of this for now to see if it shows then the same error an another file.

    I'm trying to understand if the problem is in the aspx file that references this master file (my understanding is that it does exists) or if this a problem with the master file itself...

    Monday, March 18, 2019 9:59 AM
  • User-1793215261 posted

    Thanks Patrice

    Here is a link to a screenshot showing VisualStudio2017/DimaWeb on my C drive: http://i65.tinypic.com/2s9uf06.jpg 

    Inside the DimaWeb folder that you can see in the link (above the Packages folder and the sln file), are my aspx, etc files, including my bin folder and packages.config file (so it looks as if there are two packages files). This is the way my PC/VS has structured my project and was not determined by me.

    In the Account folder in Solution Explorer and in the Account folder in the DimaWeb folder on my PC, I have a RegisterExternalLogin.aspx file and a
    RegisterExternalLogin.aspx.vb file.

    RegisterExternalLogin.aspx is this:

    <%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="RegisterExternalLogin.aspx.vb" Inherits="Account_RegisterExternalLogin" %>
    
    
    
    <asp:Content ContentPlaceHolderID="MainContent" Runat="Server">
        <hgroup class="title">
            <h1>Register with your <%: ProviderDisplayName %> account</h1>
            <h2><%: ProviderUserName %>.</h2>
        </hgroup>
    
        
        <asp:Label runat="server" ID="providerMessage" CssClass="field-validation-error" />
        
    
        <asp:PlaceHolder runat="server" ID="userNameForm">
            <fieldset>
                <legend>Association Form</legend>
                <p>
                    You've authenticated with <strong><%: ProviderDisplayName %></strong> as
                    <strong><%: ProviderUserName %></strong>. Please enter a user name below for the current site
                    and click the Log in button.
                </p>
                <ol>
                    <li class="email">
                        <asp:Label runat="server" AssociatedControlID="userName">User name</asp:Label>
                        <asp:TextBox runat="server" ID="userName" />
                        <asp:RequiredFieldValidator runat="server" ControlToValidate="userName"
                            Display="Dynamic" ErrorMessage="User name is required" ValidationGroup="NewUser" />
                        
                        <asp:Label runat="server" ID="userNameMessage" CssClass="field-validation-error" />
                        
                    </li>
                </ol>
                <asp:Button runat="server" Text="Log in" ValidationGroup="NewUser" OnClick="logIn_Click" />
                <asp:Button runat="server" Text="Cancel" CausesValidation="false" OnClick="cancel_Click" />
            </fieldset>
        </asp:PlaceHolder>
    </asp:Content>
    
    RegisterExternalLogin.aspx.vb is this:
    
    Imports System.Web.Security
    Imports DotNetOpenAuth.AspNet
    Imports Microsoft.AspNet.Membership.OpenAuth
    
    Partial Class Account_RegisterExternalLogin
        Inherits System.Web.UI.Page
    
        Protected Property ProviderName As String
            Get
                Return If(DirectCast(ViewState("ProviderName"), String), String.Empty)
            End Get
            Private Set(value As String)
                ViewState("ProviderName") = value
            End Set
        End Property
    
        Protected Property ProviderDisplayName As String
            Get
                Return If(DirectCast(ViewState("PropertyProviderDisplayName"), String), String.Empty)
            End Get
            Private Set(value As String)
                ViewState("ProviderDisplayName") = value
            End Set
        End Property
    
        Protected Property ProviderUserId As String
            Get
                Return If(DirectCast(ViewState("ProviderUserId"), String), String.Empty)
            End Get
    
            Private Set(value As String)
                ViewState("ProviderUserId") = value
            End Set
        End Property
    
        Protected Property ProviderUserName As String
            Get
                Return If(DirectCast(ViewState("ProviderUserName"), String), String.Empty)
            End Get
    
            Private Set(value As String)
                ViewState("ProviderUserName") = value
            End Set
        End Property
    
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not IsPostBack Then
                ProcessProviderResult()
            End If
        End Sub
    
        Protected Sub logIn_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            CreateAndLoginUser()
        End Sub
    
        Protected Sub cancel_Click(ByVal sender As Object, ByVal e As System.EventArgs)
            RedirectToReturnUrl()
        End Sub
    
        Private Sub ProcessProviderResult()
            ' Process the result from an auth provider in the request
            ProviderName = OpenAuth.GetProviderNameFromCurrentRequest()
    
            If String.IsNullOrEmpty(ProviderName) Then
                Response.Redirect(FormsAuthentication.LoginUrl)
            End If
    
            ProviderDisplayName = OpenAuth.GetProviderDisplayName(ProviderName)
    
            ' Build the redirect url for OpenAuth verification
            Dim redirectUrl As String = "~/Account/RegisterExternalLogin"
            Dim returnUrl As String = Request.QueryString("ReturnUrl")
            If Not String.IsNullOrEmpty(returnUrl) Then
                redirectUrl &= "?ReturnUrl=" & HttpUtility.UrlEncode(returnUrl)
            End If
    
            ' Verify the OpenAuth payload
            Dim authResult As AuthenticationResult = OpenAuth.VerifyAuthentication(redirectUrl)
            If Not authResult.IsSuccessful Then
                Title = "External login failed"
                userNameForm.Visible = False
                
                providerMessage.Text = String.Format("External login {0} failed.", ProviderDisplayName)
                
                ' To view this error, enable page tracing in web.config (<system.web><trace enabled="true"/></system.web>) and visit ~/Trace.axd
                Trace.Warn("OpenAuth", String.Format("There was an error verifying authentication with {0})", ProviderDisplayName), authResult.Error)
                Return
            End If
    
            ' User has logged in with provider successfully
            ' Check if user is already registered locally
            If OpenAuth.Login(authResult.Provider, authResult.ProviderUserId, createPersistentCookie:=False) Then
                RedirectToReturnUrl()
            End If
    
            ' Store the provider details in ViewState
            ProviderName = authResult.Provider
            ProviderUserId = authResult.ProviderUserId
            ProviderUserName = authResult.UserName
    
            ' Strip the query string from action
            Form.Action = ResolveUrl(redirectUrl)
    
            If (User.Identity.IsAuthenticated) Then
                ' User is already authenticated, add the external login and redirect to return url
                OpenAuth.AddAccountToExistingUser(ProviderName, ProviderUserId, ProviderUserName, User.Identity.Name)
                RedirectToReturnUrl()
            Else
                ' User is new, ask for their desired membership name
                userName.Text = authResult.UserName
            End If
        End Sub
    
        Private Sub CreateAndLoginUser()
            If Not IsValid Then
                Return
            End If
    
            Dim createResult As CreateResult = OpenAuth.CreateUser(ProviderName, ProviderUserId, ProviderUserName, userName.Text)
    
            If Not createResult.IsSuccessful Then
                
                userNameMessage.Text = createResult.ErrorMessage
                
            Else
                ' User created & associated OK
                If OpenAuth.Login(ProviderName, ProviderUserId, createPersistentCookie:=False) Then
                    RedirectToReturnUrl()
                End If
            End If
        End Sub
    
        Private Sub RedirectToReturnUrl()
            Dim returnUrl As String = Request.QueryString("ReturnUrl")
            If Not String.IsNullOrEmpty(returnUrl) And OpenAuth.IsLocalUrl(returnUrl) Then
                Response.Redirect(returnUrl)
            Else
                Response.Redirect("~/")
            End If
        End Sub
    End Class

    I do not use any external logins on my Web pages.

    If I remove the two RegisterExternalLogin files (aspx and aspx.vb) from both Solution Explorer and from the DimaWeb folder on my C drive, can I get them back?

    Thanks again

    Monday, March 18, 2019 1:18 PM