As per @david-nordvall's answer the support isn't quite there. The issue I have hit is that when you add a reference to an ASP.NET Core project to an Azure Resource Group project, the Visual Studio build fails with:
[error]Deployment.targets(57,5): Error MSB3030: Could not copy the file "obj\Release\ProjectReferences\MyAspDotNetCoreProject\package.zip" because it was not found.
This is the part of the .deployproj
file with the reference:
<ProjectReference Include="..\MyAspDotNetCoreProject\MyAspDotNetCoreProject.csproj">
<Targets>
</Targets>
<AdditionalProperties>WebPublishMethod=Package;DeployOnBuild=true;Configuration=Release;PublishProfile=Default;DesktopBuildPackageLocation=..\MyAzureDeployProject\$(ProjectReferencesOutputPath)\MyAspDotNetCoreProject\package.zip</AdditionalProperties>
<IncludeFilePath>$(ProjectReferencesOutputPath)\MyAspDotNetCoreProject\package.zip</IncludeFilePath>
</ProjectReference>
The problem seems to be the missing targets. Here is a reference to a "classic" ASP.NET project:
<ProjectReference Include="..\MyClassicAspNetProject\MyClassicAspNetProject.csproj">
<Targets>Build;Package</Targets>
<AdditionalProperties>PackageLocation=..\MyAzureDeployProject\$(ProjectReferencesOutputPath)\MyClassicAspNetProject\package.zip</AdditionalProperties>
<IncludeFilePath>$(ProjectReferencesOutputPath)\MyClassicAspNetProject\package.zip</IncludeFilePath>
</ProjectReference>
I thought I'd be clever and manually create the reference to the ASP.NET Core project using the same definition as the "classic" ASP.NET project (substituting the names), but then the build fails with:
error MSB4057: The target "Package" does not exist in the project.
So I simply removed the Package
target:
<Targets>Build</Targets>
And the build failed again! Back to the first error:
error MSB3030: Could not copy the file "obj\Debug\ProjectReferences\MyAspNetCoreProject\package.zip" because it was not found.
But by some off chance, the build had already kicked off in Azure DevOps (got to love building on Pull Requests) and it had succeeded!
The difference in my Azure DevOps build is some extra parameters for MSBuild:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="C:\temp" /p:RunOctoPack=true /p:platform="Any CPU" /p:configuration="Release" /p:VisualStudioVersion="15.0"
I could even run MSBuild locally and it succeeded. I haven't worked out exactly why it's working with the extra parameters.
Hope that helps.
[Update]
It's worth noting that if you've got this far with ASP.NET Core via ARM deployment, you'll need to set the AppOffline
property in your MSDeploy
to true
:
"resources": [
{
"apiVersion": "2016-03-01",
"name": "MSDeploy",
"type": "Extensions",
"dependsOn": [
"[concat('Microsoft.Web/Sites/', parameters('appName'))]"
],
"properties": {
"packageUri": "https://mystorageblob.blob.core.windows.net/package/my_webdeploy_package.zip",
"dbType": "None",
"connectionString": "",
"AppOffline": true,
"setParameters": {
"IIS Web Application Name": "[parameters('appName')]"
}
}
}
],
(From here)
The problem is that in ASP.NET Core the files are locked.