Adding NuGet package ContentFiles to Azure Functions solution - azure

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.

Related

Metadata file could not be opened -- PE image doesn't contain managed metadata

In azure functions I uploaded private dll's to bin folder using following instructions
If you need to reference a private assembly, you can upload the assembly file into a bin folder relative to your function and reference it by using the file name (e.g. #r "MyAssembly.dll").
but I when run the function, I am getting this error for every dll. "Metadata file could not be opened -- PE image doesn't contain managed metadata"
Looks like you're adding references to native binaries as well. Your references must be .NET assemblies. If you're deploying native indirect dependencies, you don't need to reference those from your function script.
UPDATE: There as a defect in the last portal deployment causing the content of files uploaded in the portal to be prefixed and suffixed with multipart form data, invalidating files.
The issue has been fixed and is being rolled out, but in the meantime, please upload the files using Kudu to workaround this issue. You can find more information about the problem here (and by following the issue link)
I also faced the same issue while building MAUI app in android platform. A native module was present in the project with .so extension. But a windows native DLL also present in the project for the purpose for running the same project in windows. Excluding the windows native DLL while building running in android fixed the issue. Sometimes I have to close the project and delete bin and obj folder and then rebuild the project to get rid of this issue.

How to add nuget server dll into the solution

I started a new solution all together and this project required to use DLLs that are in nuget server. I was given nuget server path along with user name & pwd.
I have enabled pacakge manager for solution whihc created .nuget folder along with three files.
But, when I selkect pacakge manager from solution and it doest show up any dlls under isntalled pacakges. I need to pull some 5 odd dlls from nuget server. pls help me how to do this to pull the dlls from server and add it to project as a referrences.
?

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

Publishing a Web Application from VS2012 is wiping out user content

I'm attempting to use Web Deploy to Publish a Web Application.
I want Visual Studio to delete any files that no longer exist, so I've checked the "Remove additional files at destination" setting in my Publishing profile.
However, I want VS to ignore the /Content/uploads folder, as it contains contents that my users have uploaded. Naturally, the contents are different in my development site than they are in the live site.
Unfortunately, I have been unable to discover a way to make Visual Studio ignore this folder when publishing (it wants to delete all of the content, since it doesn't exist in the project).
Does anyone know of a way to exclude specific folders on the target site from being examined by Web Deploy?
I had a similar problem, wanting to keep some files in the deployment package even though they're not part of the project.
Try to create a custom MSBuild target for this, that works for me.
Here is a Getting Started MSBuild reference
Hope this helps.
All the best.
I was unable to find a suitable solution for this issue, so I've created my own:
https://pubsync.codeplex.com/
PubSync enables quick and reliable file syncing for publishing Visual Studio projects.

Include/Exclude files when creating Azure package

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.

Resources