Creating a NuGet package for UWP library containing custom Templated Control - nuget

I have a UWP class library for Windows 10 which contains a custom templated control, VisualControl. The default template is defined in the Themes\Generic.xaml file.
Here is the directory structure I have created for the NuGet package which targets x86, x64 and ARM.
When I creat a NuGet package with these files, add it to my test application and add the VisualControl to the XAML file, the default theme is not applied to the VisualControl.
Am I packaging the file in an incorrect way? How do I ensure that the default template defined in the Generic.xaml file is picked up and applied to the Control.
Also, are the following files required in the NuGet package? If yes, where should they be placed?
Generic.xbf
TestVisualControl.pri
TestVisualControl.xr.xml

Found out the solution.
The Generic.xbf file should be placed in the Themes folder along with Generic.xaml.
The TestVisualControl.xr.xml file should be placed in a folder named TestVisualControl. This folder should be placed inside uap10.0 folder of each platform.
The TestVisualControl.pri should be placed inside the uap10.0 folder of each platform.
Here is what the final folder structure should look like
Creating a NuGet package with this folder structure would ensure that the style defined in the Generic.xaml file is loaded.

Related

Package all content from a folder using NuGet

We would like to use Octopus Deploy for our Deployments. I am trying to package our assemblies using Nuget for the same. We maintain lots of solutions (contains lots of independent projects) and We have our custom windows host which doesn't have any direct reference to the application assemblies. Currently We Zip all the files and extract them to install the windows services. I am exploring a way to package all the content in zip file to NuGet Package. is that possible. What is the best and easiest way to package considering our current implementation. I tried creating .NuSpec file and NuPkg manually using package explorer. But it's not visible and only visible in package explorer.
you can bundle all artifacts by defining metadata inside a nuspec files , nuget package created using that nuspec file will contain all artifacts defined in nuspec file, you can do the whole process from your command line as well , when creation of package is done from command line you can see your package in the same path where nuspec file resides and most important thing nuget package is also a type of zip file , so you can simply rename your example.nupkg to example.zip and verify the bundled contents.

Build a NuGet package from project but without any references

I have created a T4 template that I want to reuse in several projects using NuGet. This template is based on a custom class so I need to distribute a DLL with the template. The DLL is used by the template during generation, but is not used by the project itself so I do NOT want it added to the target project as a reference.
My .nuspec file includes my DLL and places it in the root of the package which will prevent it from creating a reference and everything works fine if I build my package by hand. Unfortunately, I want to use the "nuget pack" command to automatically pick up the version number. When I run this command and reference the project file, it includes my DLL twice, once in the root (as I specified in my nuspec file) and an additional time in the lib folder (along with everything in the bin folder).
How can I automatically build my NuGet package without including any references. It seems there are several solutions, but I can't figure any of them out:
Let nuget include my DLL in the lib folder, but prevent it from creating the reference. I know I can use the <references> section to reference some DLLs and not others, but in this case I don't want it to reference any. If I leave the <references> section blank it is either ignored or I get an error depending on what level I leave blank.
Prevent nuget from including any DLLs automatically and only include the files in the <files> section of the nuspec file. Unfortunately, I can't figure out how to build the package from the project file without it including my DLL automatically.
Any thoughts?
If you right-click the DLL, you'll probably see that its "build action" is set to "content". Try setting it to "none".

Creating folder with contents in project root

I developed a tool that besides DLL requires a strong named folder with 2 files in solution. Using NuGet GUI I created the folder and populated with files, but when I install package, the only DLL created but folder with 2 files are not. How can that be fixed?
NuGet has a set of conventions that define certain folders inside the NuGet package that will result in different actions being taken when the package is installed or uninstalled.
In order for folders to be created inside the project, when the NuGet package is installed, the folders need to be inside a Content directory. If you look at the jQuery package, it has a Content\Scripts folder with files inside it. This Scripts folder will be created inside your project, along with its files, when you install the jQuery NuGet package.
\Content
\Scripts
\jquery-2.1.0.js

What files should I check in for an SSIS project?

In my SSIS project folder I have extra files in addition to the three package (.dtsx) files that I created. There is a ProjectName.database file, a ProjectName.dtproj file, and a ProjectName.dtproj.user file.
When I build the project, the dtsx files are copied to a folder called "bin" inside the project folder.
When I create a deployment manifest, the three package files are copied to a folder called "bin/Deployment" along with a new ProjectName.SSISDeploymentManifest file.
Which of these files should I check in to source control?
I think only the three package files and the deployment manifest are useful to me.
You will want to keep:
*.dtsx - your packages
*.dtproj file - project files
.sln file - solution file - if You have only one project you might not have this one
*.database - take a look at quotation below
deployment manifest file - allows you to deploy your packages to a target location using a wizard
MSDN states following:
The *.database file contains information that Business Intelligence Development Studio requires to open the Integration Services project.
*.dtproj.user and .sln.suo files are not needed because they (from the same link): contain information about your preferences for working with the project.

Is there a way to specify Build Action=None with nuspec?

My company has an assembly versioning package that I've written in powershell and is distributed amongst my colleagues via our internal nuget feed.
There are a couple of template files which can be user-modified after the package in installed. These files are being included in the package which we generate via
nuget pack xxxx.csproj
We've done a little investigation and there files are not packaged when we change the Build Action to None.
Is there a way to tell nuspec to add the files to the project with Build Action set to None*?
Alternatively is there a way to tell nuget pack to not include certain files in the package in generates?
NuGet pack has an Exclude parameter that can be used to filter out files that you don't want in your package.
If you want to include files that are auto excluded from your project then you need to add a nuspec to your project and add a element that includes that file.
More information here:
http://docs.nuget.org/docs/creating-packages/creating-and-publishing-a-package#From_a_project
http://docs.nuget.org/docs/reference/command-line-reference#Pack_Command
nuget pack will ignore any files or folders that start with period/full stop. So one easy way would be to rename your template files or the folder they are located in to start with a period/full stop if possible.