Friday, February 17, 2017

Could not load file or assembly Microsoft.WindowsAzure.ServiceRuntime | AzureCloudService - Error

Some assembly (.dll) file is missing when deployed in azure

Could not load file or assembly 'Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. 
Solution:
To fix the problem, add the following DLL's as references to "YourApplicationSolution" project, and make sure "Copy Local" is set to true.

Microsoft.WindowsAzure.Diagnostics
Microsoft.WindowsAzure.ServiceRuntime
Microsoft.WindowsAzure.StorageClient
You'll probably have to go to your application Bin folder to get the DLL's and put them back into your site's BIN folder.
Next, add all the DLLs as references and re-built the solution again.
OR
Expand the references section in Visual Studio and mark all the Azure DLLs as Copy Local = "True" - the Azure SDK DLLs need to be included in the bin directory they are not GACed.
If that fails, add an assembly binding redirect to the web.config...
<dependentAssembly> <assemblyIdentity name="Microsoft.WindowsAzure.ServiceRuntime" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" /> </dependentAssembly>

Sunday, February 12, 2017

Getting error while generating azure package || Azure Package & Config file generation

Getting error while generating azure package


  1. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters and the directory name must be less than 248 characters. C:\Program Files (x86)\MSBuild\Microsoft\Cloud Service\1.0\Visual Studio 10.0\Microsoft.cloud service.targets 202 5 FileSystemCreator
  2. Rename the folder where the project is present with a shorter name.
Follow the below procedure to Fix:
  1. Go to the Cloud Service project folder.
  2. Edit the user cloud service options file (*.ccproj file) in notepad. 
  3. Add the ServiceOutputDirectory element with the value "c:\azure" for example.
  4. Open the solution in Visual Studio again and the error has gone.
  5. Example: