Question

I try to use the VSMonoTouch Plugin for Visual Studio 2012 to build my cross platform solution completely in Visual Studio. As this is not really supported and the maintainer does not really look like he will create a new branch some other guys ported it to 2012. Looks to work everywhere just not one my installation.

First some information on what is installed:

  • Win 8 64 Bit
  • VS 2012 Premium
  • .NET 4.5
  • v1.0-Folder in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework

What I've already done is getting all the code and start the extension using VS. I can see, that in the following code this exception occurs: (Exception occurs on line item.Value=v10FrameworkName)

Code:

public int OnAfterOpenProject(IVsHierarchy pHierarchy, int fAdded)
{
    const string targetFrameworkMoniker = "TargetFrameworkMoniker";

    object projectObj;
    pHierarchy.GetProperty(VSConstants.VSITEMID_ROOT, (int)__VSHPROPID.VSHPROPID_ExtObject, out projectObj);
    var project = (Project) projectObj;

    if (VSMonoTouchPackage.IsMonoTouchProject(project))
    {
       var v10FrameworkName = (new FrameworkName(".NETFramework", new Version(1, 0))).FullName;
       var item = project.Properties.Item(targetFrameworkMoniker);
       if (item != null)
       {
          if (item.Value == null || (string) item.Value != v10FrameworkName)
          {
              // Here is where the Exception occures
              item.Value = v10FrameworkName;
          }
       }
       else
       {
           project.Properties.Item(targetFrameworkMoniker).Value = v10FrameworkName;
       }
   }
   return VSConstants.S_OK;
}

Exception:

HRESULT: -2147352567

Exception Message:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

Exception Stacktrace:

at EnvDTE.Property.set_Value(Object lppvReturn) at Follesoe.VSMonoTouch.SolutionEvents.OnAfterOpenProject(IVsHierarchy pHierarchy, Int32 fAdded) in c:\Projects\VSMonoTouch\VSMonoTouch\VSMonoTouchPackage.cs:line 170

What is really strange is when I open a csproj-MonoTuch-Project, the project keeps loading/unloading - loading/unloading - ... until VS crashs. There is no exception. When opening an existing solution containing an MonoTouch-Project I get the exception above. (For example opening MvvmCross-vNExt-Solution)

What seems to work fine is my v1.0 .NETFramework folder as I can switch a Console application to this target Framework in Project properties. When I simply uncomment the crashing code, VS will load the project, but seems then to be in a wired state. I cannot change the target Framework (there is simply no choice in project properties)

Any small idea what could trigger this exception would be highly appreciated.

Was it helpful?

Solution

Ok, I've solved the problem by doing a clean installation of VS. Seems to be that there was something corrupt in my old one..

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top