Azure Emulator - Could not load file or assembly - azure

All.
I've got Azure SDK 1.7 installed.
All the assemblies in the solution are compiled with 'Any CPU' set up. But one of them fails when i start the solution in Azure emulator on my machine.
The error is very strange: "Could not load file or assembly 'XXX' or one of its dependencies. is not a valid Win32 application."
It becomes more complicated to find the reason, cause on the other machine everything works fine. Also I have no error when deploy it to Azure environment.
Tried to start emulator using IIS Express 8 and full IIS. Also tried to enable 32bit apps support when hosted under full IIS. Converted project to use 1.8 SDK.
But with no success.
Here is also some info from Visual Studio General output. Seems, here is the reason for the issue.
Windows Azure Tools: Warning: Unable to delete file fr000001.xml.
Windows Azure Tools: Warning: Unable to delete file fr000002.xml.
Windows Azure Tools: Warning: Unable to delete file fr000001.xml.
Windows Azure Tools: Warning: Unable to delete file fr000002.xml.
Windows Azure Tools: Warning: Unable to delete file fr000001.xml.
Windows Azure Tools: Warning: Unable to delete file fr000002.xml.
Windows Azure Tools: Warning: Unable to delete file fr000001.xml.
Windows Azure Tools: Warning: Unable to delete file fr000002.xml.
Windows Azure Tools: Warning: Unable to delete directory deployment17(397)
Couldn't find the process that can create such behavior. Of course, tried to restart my machine and to remove all the readonly properties from project files.
Will be glad to see any possible solution.
Thanks in advance.

Ok. I've found the source of problem.
When installed RedGate .NET Reflector, it created environment variable with name DEVPATH.
It's value is: "C:\ProgramData\Red Gate.NET Reflector\DevPath"
I've looked through this path and found there obsolete dll for my project. As result, it searched for the reference as it performs with GAC and always found incorrect one.
Removed and everything works.

Related

ASP.NET Core app build to target Core 2.1 fails on IIS 10 server where Core 2.1 is installed

I have just setup up IIS 10 on a clean Server 2016 hosted server, and installed the following packages that I have gleaned should be on the machine to allow IIS to host ASP.NET Core applications:
aspnetcore-runtime-2.1.0-win-x64.exe
dotnet-hosting-2.1.0-win.exe
dotnet-runtime-2.1.0-win-x64.exe
I have installed my app straight into the Default Web Site and replaced all files in C:\inetpub\wwwroot\ with my app files. I also did assign the web site an app pool with no managed code, so that isn't my problem.
Last time my app was built with 2.0, and I installed the latest versions of the above packages, which I'm sure was 2.0, and the only error I had was that the command dotnet that IIS uses to invoke Kestrel to run the site, was not in the PATH env. variable
Now when I try and browse to localhost on the Server 2016 machine, it gives me the following error, found in the Windows event log:
Application 'MACHINE/WEBROOT/APPHOST/DEFAULT WEB SITE' with physical
root 'C:\inetpub\wwwroot\' failed to start process with commandline
'dotnet .\QuickDrive.Mvc.dll', ErrorCode = '0x80004005 : 8000808c.
Initially I tried with the same build as before, which was 2.0, and when I got this error, I rebuilt the app to target 2.1. Nearly every search result and relevant SO answer I can find suggest a version conflict, but now there should at least be no version conflict between the runtime and hosting package on the server. Maybe there are other version conflicts I am not aware of though?
At very least I'm asking for some advice on how to get more detailed diagnostic information, even if I don't get an answer that tells me straight what config options and versions to check on Windows and on IIS.
You have to install the Core SDK for whatever version you want to target in Visual Studio. Installing the runtime alone won't do the trick. You may have the restart Visual Studio afterward to see it in the list.
Here is a link to the SDK 2.1 download (the latest as of this writing).
I solved the problem by running dotnet myWesite.dll in PowerShell, and first I found that dotnet.exe was not in the PATH environment variable, and after fixing that, running dotnet myWesite.dll again gave me a meaningful error message that an assembly was missing because it had not been included when I published the website.
I faced the same error on the dev machine in IIS Express. MVC App stopped working all of the sudden. Eventlog gave the 0x80004005 error code.
After trying multiple suggestions, the solution to debug the wired error code was to run the app in the console:
[Project bin folder]> dotnet [projectname].dll
It appeared that during the NuGet package update, the dotnet core version was accidentally updated to 2.1.4 where as the installed version was 2.1.3
[could be a bug in Nuget manager as the update was from there]
I edited the project file to reference the available version (2.1.3) and the app started to work properly.

Unable to build Compiled Azure Function in VSTS (Error MSB4019)

I have created an Azure Function using the latest build of visual studio 2017 (15.3.1).
This build allows me to do the:
New Project > Azure Function App approach
This produces a .csproj (not a .funproj file) and it's doesn't come bundled with a website or anything. I've tried .Net 4.6 and 4.6.1 as the target framework and neither have worked.
I get the following error in VSTS:
C:\Users\Builder.nuget\packages\microsoft.net.sdk.functions\1.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.props
(13, 3)
C:\Users\Builder.nuget\packages\microsoft.net.sdk.functions\1.0.2\build\netstandard1.0\Microsoft.NET.Sdk.Functions.Publish.props(13,3):
Error MSB4019: The imported project "C:\Program Files (x86)\Microsoft
Visual
Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.NET.Sdk.Publish\Sdk\Sdk.Props"
was not found. Confirm that the path in the declaration is
correct, and that the file exists on disk.
There is no node in my .csproj file so I am not sure where it is getting that from.
I'm using the latest NuGet option in VSTS, I'm using the Latest VS Version option as well.
The build steps are:
Get Sources
NuGet Restore
Build Solution (MSBuild.exe exited with code '1' every time)
Is there any way to build (and then release) compiled .Net functions in VSTS at the minute?
I was able to solve this by swapping the build agent from the "Default" group to the latest, "Hosted VS 2017" group, and that has compiled fine.
Looks like the machine is missing the latest dotnet cli. I'm not too familiar with VSTS build machines, but you'd need to get that on there somehow https://www.microsoft.com/net/download/core

Azure SDK 2.5.1 fails to Publish cloudService

After successfully upgrading my cloud service to the new "Azure SDK for .NET 2.5.1" I got the following error when trying packaging/publishing.
Could not load file or assembly 'Microsoft.WindowsAzure.Packaging,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or
one of its dependencies. The system cannot find the file
specified. C:\Program Files
(x86)\MSBuild\Microsoft\VisualStudio\v12.0\Windows Azure
Tools\2.5\Microsoft.WindowsAzure.targets
The related line in the "Microsoft.WindowsAzure.targets" config file is 2930 which obviously is related to CSPack.
<CSPack
ServiceDefinitionFile="#(TargetServiceDefinition)"
Output="#(PublishServicePackage)"
PackRoles="#(Roles)"
SiteMapping="#(SiteMapping)"
RoleProperties="#(RoleProperties)"
ImportedModules="#(ImportedModules)"
CopyOnly="false"
>
</CSPack>
So I went on to create a fresh new Azure Cloud service in a fresh new project to see if something went wrong with the upgrade. Unfortunately the problem persists.
Is there a workaround or will I have to rollback to v2.4 (that will cause me significant amount of pain)
I am running on VS 2013 update 4.
Sorry for the trouble, everyone. We are investigating what's causing this. It looks like there is an odd behavior with our installers where in some environments those two binaries are not installed correctly.
We did discover if the 2.5.1 Azure Authoring Tools is removed and reinstalled, the missing binaries will be installed correctly. So if you run into this issue, please remove Authoring Tools v2.5.1 from Programs and Features, and reinstall via either the Web Platform Installer or the direct download links:
http://download.microsoft.com/download/1/E/7/1E76DD6F-66F1-47E0-A76A-3BBAAC617316/MicrosoftAzureAuthoringTools-x64.msi
http://download.microsoft.com/download/1/E/7/1E76DD6F-66F1-47E0-A76A-3BBAAC617316/MicrosoftAzureAuthoringTools-x86.msi
Apologies for the inconvenience. We will continue the investigation.
I searched locally for the required dll and found it in almost all previous versions of the Azure .Net SDK had it (from v2.0 onwards I believe).
So in order to fix this you need to copy the following dlls from the previous version v2.4 of the SDK to the similar location for v2.5.
SDK installation paths.
Src location: "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.4\bin"
Dst location: "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.5\bin"
Dlls to copy (missing):
Microsoft.WindowsAzure.Packaging.dll
Microsoft.WindowsAzure.ServiceModel.Common.dll
Since there may be a better answer to this I will not mark this as an answer yet.

Windows Azure Tools: Error: Unable to find nativerd.dll

I am using VS2010 for a simple Windows Azure project, When I run the project I get error
following error
Windows Azure Tools: Error: IIS is not installed
Windows Azure Tools: Error: Unable to find nativerd.dll. Please verify that IIS is installed properly.
Windows Azure Tools: The system is missing a prerequisite to execute the service. Please see the release notes.
I have IIS 8 Express installed already, what else should I install to get rid of this error? Also installed VS2010SP1AzurePack.2E2.2E1
Any help would be much appriciated.
Regards,
Mansoor.
Turned out that IIS feature was not enabled in Windows Features...!
It worked after I enabled it.

Package / Publish error on Azure

I've recently upgraded an Azure Project from Azure SDK 1.6 (Visual Studio 2010) to Azure SDK 2.0 (Visual Studio 2012). The project will build with no errors or warnings on the local machine. I can debug on the local machine, but I cannot package or get a build on the build server. The error I get is:
error MSB4057: The target "PipelineTransformPhase" does not exist in the project.
I've confirmed that the C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplications.targets file exists locally and on the build server.
The original project pointed to the \v10.0\ path and I manually changed that to the \v11.0\ path trying to resolve the error with no luck.
I have noticed that when project is not able to access Microsoft.WebApplications.targets file it usually says "The target "PipelineTransformPhase" does not exist in the project."
You need to import Microsoft.WebApplications.targets file into the project. You can do it by adding following line in your project.
<Import Project="C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\WebApplications\Microsoft.WebApplication.targets" />
When importing Microsoft.WebApplication.targets into the project file, make sure you don't set explicit Condition="false". I have seen similar error when Microsoft.WebApplication.targets was imported to the project along with Condition="false".
One more thing to consider when importing Microsoft.WebApplication.targets into project file, always make sure that default variable $(MSBuildExtensionsPath32) is set to "C:\Program Files (x86)\MSBuild\".

Resources