Copied to clipboard

Flag this post as spam?

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


  • Jason Espin 368 posts 1335 karma points
    Nov 24, 2015 @ 11:31
    Jason Espin
    0

    Visual studio community 2015 breaking Umbraco projects

    Hi all,

    I have recently installed Visual Studio community edition 2015 on my second machine. I use mercurial for source management so have pulled the latest changes to my project down from bitbucket and restored the latest version onto my second machine.

    Any external packages I manage via Nuget and these are all restored successfully on project rebuild. The rebuild succeeds.

    However, if I then go to one of my views I experience the following problems.

    On my main work machine running Visual Studio 2013 my view looks like this:

    enter image description here

    Nothing wrong here. However on my other machine running community 2015 I get this:

    enter image description here

    As you can see it highlights many of the IPublishedContent methods saying:

    'IPublishedContent' does not contain a definition for 'GetPropertyValue' and no extension method 'GetPropertyValue' accepting a first argument of type 'IPublishedContent' could be found.

    It also greys out a number of my namespaces saying:

    Using directive is unnecessary

    Like I said, it compiles fine but according to intellisense these methods dont exist. I have even tried physically copying all of the files from one machine to another and using the project that way and I still have the same problem.

    I have also tried clearing out the user settings using:

    devenv.exe /resetuserdata
    

    but this doesn't make and difference.

    Does anyone know how to address this as it will have a serious effect on my team working together.

  • gary 385 posts 916 karma points
    Nov 24, 2015 @ 11:46
    gary
    0

    Hi Jason

    If you include the view file in the project, you will get intellisense.

    With file closed right click, include in project.

    After you open it initially it can take a few seconds to appear.

    Apologies if it sounds a bit like teaching granny to suck eggs, but if you include with view open, it does not update until you close and reopen.

    Hope it helps

    Gary

  • Jason Espin 368 posts 1335 karma points
    Nov 24, 2015 @ 11:49
    Jason Espin
    0

    Hi Gary,

    This is not the problem. The view file is included in the project. The problem here is Visual Studio 2015 is breaking something as we have tried pulling the solution down onto a machine with Visual studio 2013 community edition installed and that works fine.

    Kind regards,

    Jason Espin

  • Peter Kongyik 28 posts 170 karma points
    Nov 24, 2015 @ 11:57
    Peter Kongyik
    0

    Hi Jason,

    As Gary says, include the .cshtml into your project. If it already is however, ensure you have added the Umbraco.Web namespace to the web.config file under the folder where your ShowBookingForm.cshtml resides.

    It should look like this:

    <system.web.webPages.razor>
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.3.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
        <pages pageBaseType="System.Web.Mvc.WebViewPage">
            <namespaces>
                <add namespace="Umbraco.Web" />
            </namespaces>
        </pages>
    </system.web.webPages.razor>
    

    Alternatively you can add a using statement into your view, however the web.config's scope is all .cshtml file within the same folder.

    In both cases as Gary said you have to reopen the cshtml file.

    regards, Peter

  • gary 385 posts 916 karma points
    Nov 24, 2015 @ 12:10
    gary
    0

    Hi Jason

    Am using VS2015 Community and have entered your first strings and have no issue, no error.

    It is more likely a config issue, version issue, or asp.net version or MVC.

    If you want to post anything I can compare it to mine if it helps.

    Regards

    Gary

  • Jason Espin 368 posts 1335 karma points
    Nov 24, 2015 @ 12:23
    Jason Espin
    0

    I think most of you are misunderstanding. My view files are included in the project. My view files have the using statements appended to the top. This is not the issue. The issue is with Visual studio 2015 as the exact same solution in the exact same state opens fine in Visual studio 2013.

  • Peter Kongyik 28 posts 170 karma points
    Nov 24, 2015 @ 12:38
    Peter Kongyik
    0

    Well then this is strange, I too use VS Community 2015 and my umbraco projects work fine, all of them.

    Your missing methods are all extension methods, located in the Umbraco.Web namespace, you have a using for that too? I use the IPublishedContent.GetPropertyValue

  • gary 385 posts 916 karma points
    Nov 24, 2015 @ 12:40
    gary
    0

    VS2015 does not support intellisense for any project less than .net 4.5, maybe that is the issue?

    G

  • Jason Espin 368 posts 1335 karma points
    Nov 24, 2015 @ 12:52
    Jason Espin
    0

    The project is .net 4.5

Please Sign in or register to post replies

Write your reply to:

Draft