We have a C# web application solution configured to run on Azure cloud services. It’s an old solution and builds fine locally on other engineers’ laptops (has done for years), and on my previous laptop. But I have a new laptop where I’ve set up my development environment but this particular solution does not build.
There are two related build errors:
Unable to import module Diagnostics. No manifest was found.
in _ServiceDefinition.csdef _(part of the ccproj project)CloudServices58 : Cannot load imported module named 'Diagnostics.'
at C:Program FilesMicrosoft Visual Studio2022EnterpriseMSBuildMicrosoftVisualStudiov17.0Windows Azure Tools2.9Microsoft.WindowsAzure.targets
The ServiceDefinition.csdef file includes this section:
<Imports>
<Import moduleName="Diagnostics" />
<Import moduleName="RemoteAccess" />
<Import moduleName="RemoteForwarder" />
</Imports>
If I remove that first Import
line then the build succeeds.
I’ve searched everywhere for a solution. There are a couple of similar questions here on SO but the answers usually come down to installation of Azure SDK, but I can confirm I have this installed at this location:
C:Program FilesMicrosoft SDKsAzure.NET SDKv2.9
I’ve run out of options. Can any of you help?
3
Answers
Please check the steps if helps to work around:
Check the
Import Module Diagnostics Code
is under the WebRole inServiceDefinition.csdef
file.Configure
Web.config
file to add Diagnostics Module for Listeners type like:ServiceConfiguration.cscfg
Similar kind of issue is resolved here by re-installing the Windows Azure Tools of VS.
This issue has been addressing since Azure SDK 2.4 even there is no code dependent but need those modules to collect the data for debugging purposes. Try to uninstall and install again, the Azure Development Tools and its included SDK Components in VS:
Visual Studio > Tools > Get Tools & Features:
References:
I had a similar issue with "Caching" import. This worked for me:
Click to see image
The "Caching" folder was missing from the Plugins folder, so I copied it from a machine that was working. i.e. check for a missing "Diagnostics" folder.
The issue seems to be that the Azure SDK 2.9 that gets installed by Visual Studio setup is missing the Diagnostics plugin. On a working (old) machine, go to C:Program FilesMicrosoft SDKsAzure .NET SDKv2.9binplugins and copy the Diagnostics folder into the same location on the new computer.