Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Adding a NuGet file AND its folder as Links

$
0
0

I have a NuGet package that should be able to be used in both the non-sdk and the new SDK projects (Pacakge.config and PackageReference)

In the PacakgeReference projects, everything works perfectly and the file and its folder is added as links, the image below depicts this.

Solution Directory

When I install the same project into a porject using Pacakge.Config, it copies the content by default. I added an install.ps1 scirpt to add the file as a Link, but it does not add the Folder as a link as well, and thus creates a blank folder within the project's directory.

Here is the install.ps1 script:

param($installPath, $toolsPath, $pacakge, $project)$resourcesFolder = "Resources"$fileName = "UncertaintyBudgetTemplate.xlsx"$linkedItemsPath = [System.IO.Path]::Combine($installPath, "content", $resourcesFolder, $fileName)foreach($item in Get-ChildItem $linkedItemsPath){    $projectItem = $project.ProjectItems.Item($resourcesFolder).ProjectItems.Item($fileName)    #Delete if the item already exists    if ($projectItem -ne $null)    {        $projectItem.Delete()    }    $item = $project.ProjectItems.Item($resourcesFolder).ProjectItems.AddFromFile($linkedItemsPath)    $item.Properties.Item("CopyToOutputDirectory").Value = 2}

This is what the consuming project looks like after the package has been installed:

Consuming project's directory

Notice that the Resources folder is not added as a link.

Is there a way to add the folder as a link (From the pacakges folder) as well?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>