Azure deploy missing XML doc files from deployment target - azure

I have a solution. 2 projects within the solution produce XML documentation, that I need to copy to the bin folder web root when I deploy to azure.
Locally, I notice that when I build my solution, those 2 XML files get copied with the DLL into my web/bin folder. When I run my un-modified deploy.cmd file locally, I also notice that kudosync picks those up and hapilly puts them into my artifacts/wwwroot/bin folder.
But - when I deploy to azure by pushing to github, the local deployment temp folder on azure doesn't contain the XML files, and thus they don't get picked up. I added some post-build "DIR" commands to the deploy.cmd file to see what is going on, and the XML files just aren't there in the %DEPLOYMENT_TEMP%\bin\ folder.
Anyone know what's going on here?

Aha - it's because when you build from MSBUILD, it doesn't generate the XML docs for the related projects. I was getting them locally because I'd at some point built from VS, which generated them.

Related

Kudu Zip Deploy copies files that have not changed

The current setup is that we're using gulp to build our VS solution using MSBuild and an Azure DevOps release pipeline to deploy our build artifacts via the Kudu Zip Deploy API (via PowerShell) to our Azure App Service.
Kudu appears to copy files that are unchanged, which appears to be causing unnecessary slowness on the target server because it causes the server to restart. Here's one example:
The contents of this file have not changed (as well as other binary files), but what probably has changed is the timestamp due to the way we're generating / regenerating some of these artifact files.
I have tried to see if Kudu can be configured to ignore timestamps, but there doesn't seem to be an option for it, and it might also not be a good solution. According to the Kudu zip deploy docs:
Efficient file copy: Files will only be copied if their timestamps don't match what is already deployed. Generating a zip using a build process that caches outputs can result in faster deployments.
Other ideas include it being a misconfiguration in the solution / file settings, or an issue with the way we're building via gulp. Any ideas on how I can prevent these unchanged files from being copied?

How do I get images to publish to Azure through VSTS (Azure DevOps) build pipelines

I've added several images to the wwroot/images folder for an asp.net core MVC project. They are included and displaying just fine locally, however when they are published through the AzureDevOps pipeline the images aren't appearing.
I've looked at the wwroot in Kudu and determined that the files aren't in the images directory in Azure, and I looked in the build command line results in AzureDevOps and I can see that the copy command for those images isn't being run during the MSBuild, but the original banner.svg images from the base project template are being copied.
I did a search files and saw that there was a file called project.assets.json which has include statements for the original images, but not the images I've added to the project. I suspect that the issue lies with the new images not being added to the project.assets.json file. This file appears to be auto generated though. I've verfieid that the new images have a build action of "Content" and I've even tried setting to copy always but to no avail. I'm thinking there is something else I need to do to get those files to be included in the project.assets.json on build.
Anyone know how to get new images to be added and recognized through the build script in Azure DevOps?
More than likely it’s your csproj file not having the right element to include those files in publish. Try doing a dot net publish locally and see if the files show up in the output directory . If they do then you only need to run that same.net publish command at the same commit. If they do not, then you need to update your CS project file to include those files , then retry dotnet publish locally to verify issue was resolved
I figured out that if you add the images to the wwroot folder, they are added to your local wwroot but never added to the wwroot folder that's in source control. I went and added the images that were missing to the wwroot/images folder in source control and check them in. Afterwards the publish went through without issue. I tried copy/pasting to the images folder and going right click > add > existing item and both did not recognize the add operation as a pending change in source. Not sure if this is a bug in VS or what.

Azure deployment from GitLab is replacing App_Data folder

I have an app service in Azure and I have connected it with my source control on GitLab, everything works fine except one thing. When I deploy from Visual Studio I can tell that App_Data should not be replaced and it works. However, deploying from GitLab (I used this tutorial https://christianliebel.com/2016/05/auto-deploying-to-azure-app-services-from-gitlab/) just replaces all the files with what I have in source control, effectively removing customers data from App_Data.
I presume that this is just simple FTP replace (as I have to run my migrations on App_Start), yet is there a way how to not replace App_Data folder on the app service when deploying from gitlab? Having synchronized App_Data with source control is not acceptable.
Thank you
I have resolved the issue by downloading deployment.zip from AppService's Kudu.
Then I edited downloaded deployment.cmd so that KuduSync ignores App_Data.
Then I inserted the modified deployment.cmd and .deployment file to the root of my git folder.

Add deployment file to VS 2017 without deploying

I just installed VS2017 and I want to deploy specific .js files without deploying the whole project. When I try to upload a new deployment file, VS force me to publish the project. Is it possible to just add a deployment file without deploying? So I can use that deployment file to deploy singles .js files or html files.
EDIT
Lets say I want to deploy a project to a virtual directory on Azure. For example to domain.com/newapp. Using a deployment file, I would like to first edit the settings, how am I supposed to do that, if VS2017 deploys the project immediately after I pick the deployment file.

MVC Web Role Post Build Event

I'm trying to copy two files to the bin directory to a Windows Azure Cloud Services deployement, I added the below Post-Build event script to the MVCWebRoleCore project properties:
copy /Y "$(ProjectDir)lib\SqlServerSpatial.dll" "$(TargetDir)SqlServerSpatial.dll"
copy /Y "$(ProjectDir)lib\SqlServerSpatial110.dll" "$(TargetDir)SqlServerSpatial110.dll"
Everything looks good locally and the two files are copied, but on Windows Azure the files are not there in the bin directory, (I checked the cloud deployment using RDC to make sure), What am I doing wrong?
Thanks
When you deploy, it doesn't care what files are in your BIN folder. It cares about what files your CSPROJ project file specifies as part of the project deployment. If these are dependencies in your References list, just make sure Copy Local is set to True and they'll be deployed.

Resources