Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to install on a new blank mvc4 project #247

Open
farrukhsubhani opened this issue Nov 14, 2013 · 10 comments
Open

Unable to install on a new blank mvc4 project #247

farrukhsubhani opened this issue Nov 14, 2013 · 10 comments

Comments

@farrukhsubhani
Copy link

I have updated all my packages on a blank project which did update Microsoft.AspNet.Razor to 3.0.0 and MVCSitemap helper is now failing on install due to it not being able to Update Razor 3.0.0 to 2.0.30506.0 saying:

Install-Package : Updating 'Microsoft.AspNet.Razor 3.0.0' to 'Microsoft.AspNet.Razor 2.0.30506.0' failed. Unable to find versions of 'Microsoft.AspNet.WebPages, Microsoft.AspNet.
Mvc' that are compatible with 'Microsoft.AspNet.Razor 2.0.30506.0'.

@maartenba
Copy link
Owner

Are you sure it's an MVC4 project youare targeting? Looks like MVC5 from the errors.

@NightOwl888
Copy link
Collaborator

I have checked the values that are inserted into the .nuspec file and they are supposed to constrain the version of Razor to < 3.0.

<?xml version="1.0"?>
<!-- MvcSiteMapProvider.MVCx.Core shared Nuget specification file; all packages share this -->
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata>
        <id>MvcSiteMapProvider.MVC4.Core</id>
        <title>MvcSiteMapProvider MVC4 Core</title>
        <version>$version$</version>
        <authors>Maarten Balliauw, Shad Storhaug</authors>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <summary>MvcSiteMapProvider is a tool that provides flexible menus, breadcrumb trails, and SEO features for the ASP.NET MVC framework, similar to the ASP.NET SiteMapProvider model. The project is hosted on http://github.com/maartenba/MvcSiteMapProvider.</summary>
        <description>This package contains only the core library for MvcSiteMapProvider. Use this package if you need to reference the library from a non-MVC project such as a class library.</description>
        <language>en-US</language>
        <tags>mvc mvc4 sitemap mvcsitemap menu breadcrumb navigation mvcsitemapprovider</tags>
        <projectUrl>http://github.com/maartenba/MvcSiteMapProvider</projectUrl>
        <iconUrl>http://download.codeplex.com/Project/Download/FileDownload.aspx?ProjectName=mvcsitemap&amp;DownloadId=196029</iconUrl>
        <dependencies>
            <group targetFramework="net35">
                <dependency id="Microsoft.AspNet.Razor" version="[2.0,3.0)"/>
                <dependency id="Microsoft.AspNet.WebPages" version="[2.0,3.0)"/>
                <dependency id="Microsoft.AspNet.Mvc" version="[4.0,5.0)"/>
            </group>
            <group targetFramework="net40">
                <dependency id="WebActivatorEx" version="2.0.1" />
                <dependency id="Microsoft.AspNet.Razor" version="[2.0,3.0)"/>
                <dependency id="Microsoft.AspNet.WebPages" version="[2.0,3.0)"/>
                <dependency id="Microsoft.AspNet.Mvc" version="[4.0,5.0)"/>
            </group>
            <group targetFramework="net45">
                <dependency id="WebActivatorEx" version="2.0.1" />
                <dependency id="Microsoft.AspNet.Razor" version="[2.0,3.0)"/>
                <dependency id="Microsoft.AspNet.WebPages" version="[2.0,3.0)"/>
                <dependency id="Microsoft.AspNet.Mvc" version="[4.0,5.0)"/>
            </group>
        </dependencies>
    </metadata>
</package>

The problem is Nuget doesn't respect this for package authors. I reported this bug to them and it looks like they are planning to fix this in 2.9 (which is due in January).

They did "fix' this for end users, but that ties our hands and puts the onus on you to fix it. Have a look at the Nuget documentation to see how to constrain versions - you will have to manually edit your packages.config file to do so.

@NightOwl888
Copy link
Collaborator

BTW - Please "vote" the issue at Codeplex to help increase the priority. The more votes, the faster and more likely it is this issue will get fixed.

@NightOwl888
Copy link
Collaborator

Oops - I misspoke. Version 2.8 is scheduled for January. Who knows when 2.9 will get released.

@farrukhsubhani
Copy link
Author

I have done couple of other tests on blank MVC4 project and

  • When adding to new MVC4 project because it has Microsoft.AspNet.Razor <3.0.0 it works great.
  • If you run update package or update Microsoft.AspNet.Razor it will be latest version which is greater than 3.0.0 and after this update i was not able to install

@NightOwl888
Copy link
Collaborator

Right. I saw on the NuGet site that they have already fixed it so it won't upgrade dependencies during an upgrade command in 2.8. However, there is nothing we can do to fix this except vote on the issue, as this is a problem with NuGet, not with our package.

However, in the meantime you can use the allowedVersions attribute to constrain the package to < 3.0. I haven't tested it, but I am hopeful that it works better than the one in the .nuspec file. The downside is that every installer of our package will need to update this manually in their packages.config file.

<?xml version="1.0" encoding="utf-8"?>
<packages>
    <package id="Microsoft.AspNet.Razor" version="2.0" allowedVersions="[2,3)" />
</packages>

This should prevent it from upgrading higher than 2.9.x when you manually upgrade MvcSiteMapProvider.

@farrukhsubhani
Copy link
Author

Does it have any known issues with Razor >3.0.0 or is there a version one can test with higher version of Razor?

@NightOwl888
Copy link
Collaborator

MvcSiteMapProvider works with Razor 3.0.0, but MVC 4 does not. The MvcSiteMapProvider.MVC5 package supports razor 3.0, but currently there is only support for MVC 5 in Visual Studio 2013. A VS 2012 update for MVC 5 is expected to be released by Microsoft within the coming weeks.

@NightOwl888
Copy link
Collaborator

@farrukhsubhani
Copy link
Author

Thanks for letting me know. I was using a vm with 2013 but will run an update on actual system and test this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants