Include/Exclude files when creating Azure package - azure

I am creating an azure package using Visual Studio (right click on azure project -> package). I would like to include and exclude some files in the package similar to this: How do you include additional files using VS2010 web deployment packages? What do I need to do to get this working for the azure package function?

Windows Azure deployment package (CSPKG) file is different then regular VS publish package even though CSPKG file is actually a zip file. You can rename CSPKG to zip and see what is inside however you can not add or delete files this way as your package will be corrupt.
The best way to add files to your CSPKG is to add those files in your VS project and then in those file properties set "copy local as true" means add these files to final output. This way when you build the CSPKG the files will be there.

Related

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.

Adding NuGet package ContentFiles to Azure Functions solution

I am having a great amount of difficulty adding content from a nuget package, into an Azure Functions application within Visual STudio.
When I create a non-azure functions library and/or console application and add the package, the new folder and files are there.
I am trying to do the following:
Add content to a NuGet package targeting net461 framework.
Have the NuGet package create a folder "Folder1" and add many JSON files into that folder. (Folder1/File1.json)
The issue I am having, is that it would seem that inside of the Azure Functions Project Type for Visual Studio, this does not work correctly.
I have added the custom "contentFiles" XML node inside of the nuspec file, and still no luck.
<contentFiles>
<files include="Folder1\File1.json" buildAction="Content" copyToOutput="true" />
</contentFiles>
The thing is, this works correctly for every other project under net461, except for the Azure Functions project-type.
Help would be greatly appreciated.

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.

Is there a way I can publish an exe file to be in the same directory as an azure web job?

I have a web job that uses an exe that is best called when it is sitting in a directory and can be located. The problem is that I don't know how to get this exe to be published with the web job. I tried using a resources folder in the webjob project and copying them to output directory but that didn't upload them and so the only other option I can think of is uploading the files to a non temporary directory on the web site but that is leaking the encapsulation of the web job.
Any thoughts?
When you use visual studio to publish a webjob, it publishes all its dependencies as well. ie VS pushes all the dependencies available under the bin folder. So, add a reference to the dependent project and VS will take care of publishing this dependency as well.

Azure publish package not including all files

I have couple of config, dll and an exe file located in the bin folder and included in project. The files are set as Content and Copy Always.
When I debug the project locally, all works fine, the problem is when I publish the cloud service, the files are missing. The files are being omitted by the Azure publish process and are missing from the deployment package file.
How do I force the files to be included in the package?
This might be a duplicate of Windows Azure not generating aspx files
Here is a quote from that post that may offer a solution:
I've had a similar issue with deploying Spark ViewEngine files in an MVC3 app. Solution for me was to make sure the files were part of the project (see smarx answer), and to explicitly set the Build Action to Content for each file. – kenxl Mar 3 '11 at 9:09

Resources