How to downgrade Visual Studio for Mac?

I need to downgrade from 7.2 to 7.1.5.2
Transitive project.json dependencies are broken in 7.2

Best Answer

Answers

  • mattwardmattward GBMember Xamurai

    You should be able to get previous versions from the account page.

    What is the problem with transitive project.json dependencies in VS Mac 7.2?

  • JonathanDibbleJonathanDibble GBMember ✭✭

    @mattward From what I can see the account page only has Xamarin Studio, not Visual Studio for Mac. @RobLander Did you find the installation you needed?

  • JonathanDibbleJonathanDibble GBMember ✭✭
    edited October 10

    Thanks @mattward

  • RobLanderRobLander GBMember ✭✭

    Thanks @mattward.

    About regression:

    • I have portable project with project.json file referencing Xamarin.Forms
    • I have iOS project with "empty" project.json file, that references portable project
    • In VS 7.1 iOS compiles fine because Xamarin.Forms dependency is transitioned to iOS project
    • In VS 7.2 I have tonns of "The type or namespace 'Xamarin' could not be found" errors
  • RobLanderRobLander GBMember ✭✭

    I've also tried to downgrade Xamarin.iOS and Mononpackages leaving VS 7.2 but that doesn't help. So it seems like it is VS related.

  • mattwardmattward GBMember Xamurai

    Looks like something has changed in NuGet 4.3 maybe. I created a new Xamarin.Forms project using VS Mac 7.2, then uninstalled the Xamarin.Forms NuGet package and added a project.json file to the PCL project (also removed the :

    {
      "dependencies": {
        "Xamarin.Forms": "2.4.0.280"
      },
      "frameworks": {
        ".NETPortable,Version=v4.5,Profile=Profile111": {}
      }
    }
    

    Then uninstalled the NuGet package from the iOS project and added a project.json file:

    {
        "frameworks": {
            "xamarin.ios10": {
                "imports": "portable-net45+win81+wp80+wpa81"
            }
        },
        "runtimes": {"win-x86" : {} }
    }
    
    

    Then reloaded the solution. The build fails in VS Mac 7.2 due to missing Xamarin.Forms types but works in VS Mac 7.1. The problem seems to be that the generated project.lock.json file does not have any Xamarin.Forms information when the NuGet restore is run using VS Mac 7.2. The main difference between VS Mac 7.1 and 7.2 is that NuGet was updated from 4.0 to 4.3.1.

    However using NuGet.exe 4.3.0 from the command line and running a restore, or using msbuild /t:restore, both seem to generated project.lock.json files with Xamarin.Forms information in them. Just VS Mac 7.2 does not.

    A potential workaround here would be to disable automatic package restore and run the restore outside VS Mac using msbuild /t:restore or nuget.exe.

  • RobLanderRobLander GBMember ✭✭

    So, it's a some kind of regression in newer nuget. Is it going to be fixed in Visual Studio for Mac updates?

  • mattwardmattward GBMember Xamurai

    Looks like a bug in VS for Mac. On upgrading to a more recent NuGet version some code in VS for Mac was removed due to a restructuring of various classes in NuGet itself. So it looks like project reference information is not being correctly setup when a restore is happening. I believe this then causes the transitively referenced NuGet packages to not be added to the project.lock.json. The lock file is also missing project references.

  • mattwardmattward GBMember Xamurai

    @RobLander - I have created a patch NuGet addin dll that should fix the problem with project.json files for VS Mac 7.2. You can download it from GitHub.

    Download that MonoDevelop.PackageManagement.dll file from GitHub. You may need to unblock it:

    xattr -d -r com.apple.quarantine MonoDevelop.PackageManagement.dll
    

    Then you can replace the existing NuGet addin .dll. I tested this locally by doing the following:

    // Make backup of NuGet addin .dll

    cp /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.dll /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.dll-backup
    

    // Replace existing NuGet addin .dll with new one.

    cp MonoDevelop.PackageManagement.dll /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.PackageManagement/MonoDevelop.PackageManagement.dll 
    

    Then the iOS project I was using for testing was building successfully and the project.lock.json file had the expected project references.

  • RobLanderRobLander GBMember ✭✭

    Btw maybe 15.4.2 service release contains this fix?

  • mattwardmattward GBMember Xamurai

    @RobLander - A fix will be in Visual Studio for Mac 7.3 at some point, not released currently. There is no fix for VS Mac 7.2 apart from using the patched binaries I linked to.

Sign In or Register to comment.