Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Daniel Rogers 67 posts 351 karma points
    1 week ago
    Daniel Rogers
    0

    uskinned v8 skin deportation to GoDaddy

    I have a uskinned v8 skin and are trying to deport it to a GoDaddy hosted site. (First umbraco 8 / uskinned site to go live)

    It wporks fine on a local machine but I get this error when live

    error CS1002: ; expected

    refering to 2 lines of code

        public string Alias => "uSkinned";
    
        public string Name => "uSkinned";
    

    the ; are there.

    C:\Windows\SysWOW64\inetsrv> "C:\Windows\Microsoft.NET\Framework\v4.0.30319\csc.exe" ....
    
    
    Microsoft (R) Visual C# Compiler version 4.8.3761.0
    
    for C# 5
    Copyright (C) Microsoft Corporation. All rights reserved.
    
    
    
    This compiler is provided as part of the Microsoft (R) .NET Framework, but only supports language versions up to C# 5, which is no longer the latest version. For compilers that support newer versions of the C# programming language, see http://go.microsoft.com/fwlink/?LinkID=533240
    
    g:\pleskvhosts\w-q-l.com.au\httpdocs\App_Code\USNBusinessLogic\USNSection.cs(7,29): error CS1002: ; expected
    g:\pleskvhosts\w-q-l.com.au\httpdocs\App_Code\USNBusinessLogic\USNSection.cs(9,28): error CS1002: ; expected
    
  • Marc Love (uSkinned.net) 330 posts 885 karma points
    1 week ago
    Marc Love (uSkinned.net)
    0

    Hi Daniel,

    You should check your web host has the minimum requirements for hosting Umbraco V8.

    https://our.umbraco.com/documentation/getting-started/setup/requirements/

    Cheers,

    Marc

  • Daniel Rogers 67 posts 351 karma points
    1 week ago
    Daniel Rogers
    0

    Hosting is

    MSSQL 2014 ASP.Net 4.8.3761 iiS10

    File permissions are all set to read write create (Full Control)

    This meets all the umbraco criteria

    Put a none uskinned umbraco 8 site up and works fine.

  • Marc Love (uSkinned.net) 330 posts 885 karma points
    1 week ago
    Marc Love (uSkinned.net)
    0

    Hi Daniel,

    With our themes we provide uncompiled code within the App_Code folder so that you can make your own customisations.

    The line that is failing is:

    public string Alias => "uSkinned";
    
    public string Name => "uSkinned";
    

    This code is shorthand code syntax which was introduced with C# 6

    Your hosting server is trying to compile this code which it doesnt recognise because it is using an older version of C#

    You can change this code to the following to avoid this error:

    public string Alias
    {
        get{
             return "uskinned";
        }
    }
    
    public string Name
    {
        get{
             return "uSkinned";
        }
    }
    

    This code is found in file: ~/App_Code/USNBusinessLogic/USNSection.cs

    Cheers,

    Marc

  • Daniel Rogers 67 posts 351 karma points
    1 week ago
    Daniel Rogers
    0

    Thanks Marc

    That go that solved for others the next lines that are going to cause an issue is in USNExamineEvents.cs

    I solved it like this (Marc please correct if I havent interpreted it correctly)

    _examineManager = examineManager ?? throw new ArgumentNullException(nameof(examineManager));
    _umbracoContextFactory = umbracoContextFactory ?? new ArgumentNullException(nameof(umbracoContextFactory));
    

    I changed these to

    try
                {
                    if (examineManager.GetType() != null)
                    {
                        _examineManager = examineManager;
                    }
                }
                catch { }
    

    and

            try
            {
                if (umbracoContextFactory.GetType() != null)
                {
                    _umbracoContextFactory = umbracoContextFactory;
                }
            }
            catch { }
    

    However I are having a little more difficulty with

    if (!_examineManager.TryGetIndex("ExternalIndex", out IIndex index))
                    throw new InvalidOperationException("No index found by name ExternalIndex");
    

    so far I have come up with

    try
                {
                    if (!_examineManager.TryGetIndex("ExternalIndex", out IIndex index))
                    {
                        //we need to cast because BaseIndexProvider contains the TransformingIndexValues event
                        try
                        {
                            if (!(index.GetType() == typeof(BaseIndexProvider)))
                            {
                                BaseIndexProvider indexProvider = (BaseIndexProvider)index;
                                indexProvider.TransformingIndexValues += IndexProviderTransformingIndexValues;
                            }
                        }
                        catch
                        {
                            new InvalidOperationException("Could not cast");
                        }
                    }                
                }
                catch
                {
                    new InvalidOperationException("No index found by name ExternalIndex");
                }
    

    but cant find a way round the "out"

  • Marc Love (uSkinned.net) 330 posts 885 karma points
    1 week ago
    Marc Love (uSkinned.net)
    0

    Hi Daniel,

    C# 7 allows for out parameters to be used without declaration. Before this version you need to declare the out parameter.

    Add the following above your if statement:

    IIndex index = null;
    
  • Daniel Rogers 67 posts 351 karma points
    1 week ago
    Daniel Rogers
    0

    Thanks again marc

    for those that come accross this the code now looks like

    try
                {
                    IIndex index = null;
                    if (!_examineManager.TryGetIndex("ExternalIndex", out index))
                    {
                        //we need to cast because BaseIndexProvider contains the TransformingIndexValues event
                        try
                        {
                            if (!(index.GetType() == typeof(BaseIndexProvider)))
                            {
                                BaseIndexProvider indexProvider = (BaseIndexProvider)index;
                                indexProvider.TransformingIndexValues += IndexProviderTransformingIndexValues;
                            }
                        }
                        catch
                        {
                            new InvalidOperationException("Could not cast");
                        }
                    }                
                }
                catch
                {
                    new InvalidOperationException("No index found by name ExternalIndex");
                }
    

    The next question is

    Usnstyle websiteStyle = (Usnstyle)Model.WebsiteStyle;
    

    CS0246: The type or namespace name 'Usnstyle' could not be found (are you missing a using directive or an assembly reference?)

  • Marc Love (uSkinned.net) 330 posts 885 karma points
    1 week ago
    Marc Love (uSkinned.net)
    0

    uSkinned uses strongly typed models. This error indicates that your website cannot find these models. Depending on the mode you are running these can be located in different places. You may not have uploaded your models to the webserver.

    For further guidance on this see:

    https://our.umbraco.com/documentation/reference/templating/modelsbuilder/

  • Daniel Rogers 67 posts 351 karma points
    6 days ago
    Daniel Rogers
    100

    I was Running in pure Live mode. But turns out that goddady is blocking this from running. I now have a class library creating a dll with the models in it.

    Also I needed to move the App_Code to its own class library.

    Doing this also meant the C#5 / 6 variations didn't matter.

    Thanks for all your help Marc

Please Sign in or register to post replies

Write your reply to:

Draft