1
votes

I've got a azure site that's been running nicely with automatic git deploys from github. Now I've updated the site to use ASP.Net MVC 5.2.2 and the deploys fails with "The type or namespace name 'AllowAnonymous' could not be found".

The site builds just fine on my local machine, even if I clone it to a clean directory so that the nuget packages have to be downloaded again.

The reference to the MVC package in the failing csproj file shows that it's referencing the packages and not some GACed dll by mistake.

<Reference Include="System.Web.Mvc, Version=5.2.2.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\packages\Microsoft.AspNet.Mvc.5.2.2\lib\net45\System.Web.Mvc.dll</HintPath>
</Reference>

The latest version that fails the build is https://github.com/KentorIT/authservices/commit/665fad58e64646da72ccc58ff080e0f7d71cc234.

Complete error

Command: "D:\home\site\deployments\tools\deploy.cmd"

Handling .NET Web Application deployment.

Kentor.AuthServices -> D:\home\site\repository\Kentor.AuthServices\bin\Release\Kentor.AuthServices.dll

AuthServicesController.cs(13,6): error CS0246: The type or namespace name 'AllowAnonymous' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\Kentor.AuthServices.Mvc\Kentor.AuthServices.Mvc.csproj]

AuthServicesController.cs(13,6): error CS0246: The type or namespace name 'AllowAnonymousAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\Kentor.AuthServices.Mvc\Kentor.AuthServices.Mvc.csproj]

Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\Kentor.AuthServices.StubIdp\Kentor.AuthServices.StubIdp.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:\DWASFiles\Sites\~1stubidp\Temp\3173ac06-c440-4bd9-a8c5-f27fecf3d007";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:Configuration=Release

An error has occurred during web site deployment.

Handling .NET Web Application deployment.

Kentor.AuthServices -> D:\home\site\repository\Kentor.AuthServices\bin\Release\Kentor.AuthServices.dll

AuthServicesController.cs(13,6): error CS0246: The type or namespace name 'AllowAnonymous' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\Kentor.AuthServices.Mvc\Kentor.AuthServices.Mvc.csproj]

AuthServicesController.cs(13,6): error CS0246: The type or namespace name 'AllowAnonymousAttribute' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\Kentor.AuthServices.Mvc\Kentor.AuthServices.Mvc.csproj]

Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\Kentor.AuthServices.StubIdp\Kentor.AuthServices.StubIdp.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="C:\DWASFiles\Sites\~1stubidp\Temp\3173ac06-c440-4bd9-a8c5-f27fecf3d007";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:Configuration=Release

An error has occurred during web site deployment.

D:\Program Files (x86)\SiteExtensions\Kudu\30.31023.1215\bin\scripts\starter.cmd "D:\home\site\deployments\tools\deploy.cmd"

1

1 Answers

0
votes

The repository contains multiple solution files, which isn't supported by the nuget restore command that is run as part of the deployment process. Before the nuget package was updated the needed MVC version must have been available in the GAC on the Azure server. Now that fails.

The solution was to remove the extra .sln files so that there's only one .sln file in the directory.