Excluding a folder from deployment and from additional file removal - iis

If a deployment has a folder full of user generated content, I exclude it from publishing in the .pubxml file with:
<ExcludeFoldersFromDeployment>somefoldername</ExcludeFoldersFromDeployment>
If you use the Remove additional files at destination option for deploying, files in this folder are still removed from the live server.
<SkipExtraFilesOnServer>False</SkipExtraFilesOnServer>
Is there any way to make the deployment process, including the clean-up of the live server, ignore a specified folder?

Related

Azure App Service keeping old files at /home/site/wwwroot/

I'm deploying nodejs application to Azure App Service with visual studio code extension (Deploy to web app). However when I inspect the files section, I found some old file/ files from previous deployment are still exist at /home/site/wwwroot/ folder.
For example first deployment have A.js, and second deployment I renamed it to B.js, /home/site/wwwroot/ will endup with A.js and B.js.
How can I resolved this issue? Any suggestion will be appreciated, thank you!
on publish page click on show all settings.
Make sure Remove additional files at destination.
Before check Remove additional files at destination. showing old file on wwwroot folder.
After check Remove additional files at destination. showing old file on wwwroot folder.

ASP.NET Core, Could not find file. How Can I publish it?

I have found many questions like this, but I'm still having problems to get a "static" file.
The task should be simple. Just get a cshtml file content. A file that it's already in the project. But it's taking forever to figure it out.
This is the error that I'm getting (only when in production)
Could not find file 'D:\home\site\wwwroot\AppData\template.cshtml'.
Looking into the 'D:\home\site\wwwroot' folder, indeed the 'AppData' doesn't exist. But then how can I publish the AppData and its files?
This is how I'm getting the file
string contentRootPath = webHostEnvironment.ContentRootPath;
return $"{contentRootPath}/AppData/{filename}";
This is inside .csproj
<Folder Include="AppData\" />
To publish the project I'm using DevOps Azure. Is there any configuration that I'm missing?
I don't know if this is the right approach, but it's working (for now).
In DevOps/Pipelines/MyMypeline/Tasks, I add Copy files Task.
Source Folder: MyProject/AppData
Target Folder: $(Agent.TempDirectory)\WebAppContent\AppData
The next task (Archive files) it was already set. So in resume, the pipeline will get the files from AppData and add in the same place where the solution was build. And the other task will zip all. Than another task (Azure Web App) will sent the zip to my AppService.
I still have to test when do the swipe from dev to prod, but for now that's it.

Azure Web Job Code looking for idyunnoo.f2h folder

I have a continuous web job and we have a certificates which are included as part of build. Build contains certificates inside a certificates but I got a below error
Could not find file
D:\local\Temp\jobs\continuous\MyWebJobProject\idyunnoo.f2h\Certificates\INT\XXXX.p12
in actual build certificates folder present in MyWebJobProject folder , folder structure is
MyWebJobProject\ Certificates\INT\XXXX.p12
I am not sure why code is checking inside idyunnoo.f2h folder and not sure when this kind of folders will create in azure web job
in my code we using AppDomain.CurrentDomain.BaseDirectory to find path of Certificate
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Certificates\Production\XXXX.p12");
Take my screenshot as an example, when you post your webjob, make sure that your certificates folder is under the Debug folder, and then package the Debug folder. There is no problem with your code. I tested it with your method. It should be the wrong path for the certificate.
Your folder structure is MyWebJobProject\Certificates\INT\XXXX.p12, So you should build your program. And rename Debug to MyWebJobProject, then compress files into zip format for upload. Make sure Certificates folder is under MyWebJobProject folder.

Azure project - which subfolders/files should be checked into version control?

I am working on a small Azure project (using Visual Studio 2015). I have created a Azure Cloud service project with only one webjob. Inside the cloud service project, vs2015 created some subfolders like 'csx', 'ecf', 'XXXXXXXXContent', 'Profile', 'rcf'.
I wonder whether I should checkin these subfolders and the files inside. Of course, the 'Release' and 'Debug' folder inside these subfolders won't be checked in.
Folders with lowercases are generated during compilation and publish process.
csx: Packaged files which ready to be published. But as of Azure Tools v1.4, it is no longer generated unless you run in emulator. This blog post describes in detail.
rcf: which stands for Role Content Files. You already has ---WorkerRoleContent and rcf is generated through build configuration. You can think it as a kind of bin folder for contents.
ecf: It is generated folder for diagnostics settings depended on `diagnostics.wadcfgx' file. The file is specific for publish settings, so you should not include it in source control.
Overall, all three folders are automatically generated for publishing and they should not be added to source control.
However, Profile and ----Content folders are required to maintain your publish settings.

Why won't it let me delete files from TFS?

I've got some files that are automatically generated and placed in a directory that's versioned using TFS. I run this and add many files like abc.sql to the server.
Then I rerun my script and something's changed such that abc is obsolete. My script deletes abc.sql from the local Windows folder.
When I run a Compare in TFS, it picks up the missing file, but when I try to choose Delete to remove the file from the server as well, I get this error:
The item $/.../abc.sql could not be found in your workspace,
or you do not have permission to access it.
I know it's not in my workspace, and that's intentional. So how can I delete a file locally, and tell TFS to delete from the server as well?
Instead of just deleting the file in the file system, you should also mark it as deleted in the workspace and check the delete in afterwards.
If you already add files to source control, you can also mark them as deleted, e.g. by running tf delete. This command also removes the file from the disk. From a .NET application, you can start it by using System.Diagnostics.Process.
You don't need to delete the file locally, just have your script delete the file from TFS. Upon commit to source control, the file is deleted locally.
http://msdn.microsoft.com/en-us/library/k45zb450(v=vs.100).aspx
tf delete [/lock:(none|checkin|checkout)] [/recursive] [/login:username,[password]] itemspec

Resources