Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot load imported module named 'Diagnostics.'

The build from VS 2013 breaks with the following error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Windows Azure Tools\2.5\Microsoft.WindowsAzure.targets(684,5): error : CloudServices58 : Cannot load imported module named 'Diagnostics.'

File ServiceDefinition.csdef:

<ServiceDefinition name="MYWEBPROJECTNAME.Azure"
                   xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition"
                   schemaVersion="2014-06.2.4">
    <WebRole name="MYWEBPROJECTNAME" vmsize="Small">
        <Imports>
            <Import moduleName="Diagnostics" />
        </Imports>
    </WebRole>
</ServiceDefinition>

I've tried to reinstall Azure SDK 2.5 from here http://azure.microsoft.com/en-us/downloads/ for VS 2013 and it didn't help.

UPDATE

It breaks at

  <ValidateServiceFiles
      ServiceDefinitionFile="@(SourceServiceDefinition)"
      ServiceConfigurationFile="@(SourceServiceConfiguration)">
  </ValidateServiceFiles>

The ValidateServiceFiles task calls Microsoft.ServiceHosting.Tools.MSBuildTasks.ImportResolver and it could not find the 'Diagnostics' module. The task gets its modules from the ImportedModules task item array.

UPDATE 2

It looks like there is some mess with VS 2012/2013 installation. On running "VS2012 x86 Native Tools Command Prompt" (%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"" x86), msbuild displayed this error. The same on running "Microsoft Azure Command Prompt - v2.5" (C:\Windows\System32\cmd.exe /E:ON /V:ON /K "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.5\\bin\setenv.cmd").

C:\SOMEPATH\MYWEBPROJECTNAME.Azure.ccproj(72,3): error MSB4019: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\ Windows Azure Tools\2.5\Microsoft.WindowsAzure.targets" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk.

Removing VS 2012 and repairing VS 2013 didn't help.

like image 659
Artyom Avatar asked Dec 29 '14 18:12

Artyom


2 Answers

I had to remove the element from my csdef file to get my project to compile. I then followed this http://msdn.microsoft.com/en-us/library/azure/dn186185.aspx#BK_Migration

like image 86
joe.feser Avatar answered Nov 13 '22 00:11

joe.feser


There is a in the diagnostics approach between the Azure SDK 2.4 and Azure SDK 2.5. You can read about the changes at https://msdn.microsoft.com/en-us/library/azure/dn186185.aspx#BK_Migration. That said, I had no code impacted by the change, but there ServiceDefinition.csdef had imports to diagnostics.

  <Imports>
        <Import moduleName="Diagnostics" />
        <Import moduleName="RemoteAccess" />
        <Import moduleName="Caching" />
    </Imports>

The error was support up in the Microsoft.WindowsAzure.targets. Since I had no code depending on these module imports I simply commented out the two references to and things built fine.

like image 30
Martin Avatar answered Nov 13 '22 00:11

Martin