Cannot load imported module named 'Diagnostics.'
Asked Answered
C

2

6

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.

Chirk answered 29/12, 2014 at 18:24 Comment(1)
Good luck, fighting the same battle.Telamon
T
5

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

Telamon answered 3/1, 2015 at 6:48 Comment(1)
That article seems to no longer be available... I am seeing this issue with 'Caching'Variscite
F
1

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.

Fornax answered 25/3, 2015 at 13:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.