Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I get "The type initializer for 'Microsoft.Cct.CctProjectNode' threw an exception." when opening ccproj files after installing Azure SDK 2.9

I have a solution with an Azure cloud project in it that's targeting the 2.7 version of the Microsoft Azure SDK which I could open/build and deploy without problems. Since Visual Studio was nagging me to update, I went ahead and installed the new Azure SDK version of 2.9. After that update, I cannot open the cloud project files, and Visual Studio (2015 Community edition, now fully updated to the latest as of the time I'm writing this) gives me this error message:

MyTest.ccproj : error : The type initializer for 'Microsoft.Cct.CctProjectNode' threw an exception.

I am able to open the project if I manually edit the ccproj file and change the

<ProductVersion>2.7</ProductVersion>

value to 2.9. However, I can not use that, since other people are working on this project and they still want to remain on the 2.7 version of the Azure SDK, which is also currently deployed to production.

Is there a way to allow Visual Studio to open older versions of cloud projects? Do I have to uninstall the Azure SDK updates?

Thank you all!

like image 403
blas3nik Avatar asked Sep 07 '16 14:09

blas3nik


2 Answers

There is an issue with the SxS compatibility for 2.9.5 and previous versions. This is very recently discovered and we are looking into a fix for the next version, but until then you will have to uninstall 2.9.

  1. Uninstall the “Microsoft Azure tools for Microsoft Visual Studio 2015 – v2.9” from add/remove programs
  2. Run msiexec /x {60473BF2-359B-43B3-AF6C-12BAC6C5BC3F}. (For VS 2013, use {438EED24-F35B-44E0-A2E2-675838273002}) This should bring up the msi dialog to uninstall “Microsoft Azure Tools for Microsoft Visual Studio 2015 Core”
  3. In add/remove programs, repair Microsoft Azure Tools for Microsoft Visual Studio 2015 – v2.7 (or v2.8 for people using that version).

Updating answer. The most common GUIDs for #2 are :

  • {60473BF2-359B-43B3-AF6C-12BAC6C5BC3F}
  • {438EED24-F35B-44E0-A2E2-675838273002}

If you get an error "This action is only valid for products that are currently installed." try using {8664E001-704C-4EFB-B68D-6A3DEF60BBEE}.


The MSFT Support forum on this is here

Connect ticket is here

like image 121
kwill Avatar answered Oct 20 '22 17:10

kwill


Solution:

  • Uninstall the “Microsoft Azure tools for Microsoft Visual Studio 2015 – v2.9” from add/remove programs and any other v 2.9 components
  • Run “msiexec /x {60473BF2-359B-43B3-AF6C-12BAC6C5BC3F}” or {8664E001-704C-4EFB-B68D-6A3DEF60BBEE}. (For VS 2013, use {438EED24-F35B-44E0-A2E2-675838273002}) This should bring up the msi dialog to uninstall “Microsoft Azure Tools for Microsoft Visual Studio 2015 Core”
  • In add/remove programs, repair Microsoft Azure Tools for Microsoft Visual Studio 2015 – v2.7 (or v2.8 for people using that version).

Exceptions:

In certain situations this might not be enough. Still, there are solutions for these exceptions also. If you still get the error message you might want to have a clean install. To do that please use the following command: Get-WmiObject -Class win32_product | Out-File c:\temp\.txt

This will create a file in the location you specified with all packages installed on your computer. Search through that file and use: msiexec /x <any GUID you think necessary>

You can check here what are the components the 2.8 (if that is the case for you) package contains so you would know what you should or should not have: https://www.microsoft.com/en-us/download/details.aspx?id=50041

After removing everything you should reinstall 2.8.2 using the web package installer and check if that works.

More Exceptions:

At this point the original issue should be gone but you might run into one of the following errors I pasted at the end of the article. For the first error you should register the assembly. You can list the assemblies using:

gacutil -l >yourassemblies.txt

Simply open the Developer Command Prompt (available in Start Menu>App>Visual Studio) and run the command.

The dll can be found here: C:\Program Files\Microsoft SDKs\Azure

You can register it using the same prompt with this command: gacutil /i yourdll.dll

For the second exception: Use procmon from here: https://technet.microsoft.com/en-us/sysinternals/bb896645

Find the path that Visual Studio is searching in by capturing the VS process (devenv) while reproducing the error.

Copy the files from here: C:\Program Files\Microsoft SDKs\Azure\Emulator to the path you discovered.

See also: Cannot run Windows Azure project due to Error: Unable to find fileDFUI.exe please verify your install is correct

Assembly:

The "DeleteCurrentDeployment" task failed unexpectedly.System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ServiceHosting.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.File name: 'Microsoft.ServiceHosting.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' at Microsoft.Cct.Debugging.DevFabricService..ctor() at Microsoft.Cct.CctProjectNode.<>c.b__121_0() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Func1 valueFactory) at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Func1 valueFactory) at Microsoft.Cct.CctProjectNode.get_DevFabricService() at Microsoft.Cct.CctBuildDeploymentTaskHost.DeleteCurrentDeployment() at Microsoft.CloudExtensions.MSBuildTasks.DeleteCurrentDeployment.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()WRN: Assembly binding logging is turned OFF.To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.Note: There is some performance penalty associated with assembly bind failure logging.To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

Missing file:

The "DeleteCurrentDeployment" task failed unexpectedly.Microsoft.ServiceHosting.Tools.DevelopmentFabric.DevFabricException: Unable to find file 'DFUI.exe' please verify your install is correct. at Microsoft.ServiceHosting.Tools.Utility.ProcessWrapper.ResolveBinaryFullPath(String binaryName) at Microsoft.ServiceHosting.Tools.Utility.ProcessWrapper..ctor(String binaryName, String arguments, Boolean breakAway) at Microsoft.ServiceHosting.Tools.DevelopmentFabric.DevFabric..ctor(Boolean singleInstance) at Microsoft.Cct.Debugging.DevFabricService..ctor() at Microsoft.Cct.CctProjectNode.<>c.b__121_0() at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Func1 valueFactory) at System.Threading.LazyInitializer.EnsureInitialized[T](T& target, Func1 valueFactory) at Microsoft.Cct.CctProjectNode.get_DevFabricService() at Microsoft.Cct.CctBuildDeploymentTaskHost.DeleteCurrentDeployment() at Microsoft.CloudExtensions.MSBuildTasks.DeleteCurrentDeployment.Execute() at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() at Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()

like image 7
Dini Avatar answered Oct 20 '22 16:10

Dini