Nuget Package - Rename the file based on the project namespace.

As part of my package, I need to add the xml file to the settings folder and call it {myrootnamespace} Settings.xml.

Is it possible? I looked at install.pss1 to achieve this, but my powershell is not very much.

+5
source share
1 answer

I hacked it. I create a file called settings.xml in the settings folder and rename it accordingly.

param($installPath, $toolsPath, $package, $project)


    $rootnamespace = $project.Properties.Item("RootNamespace").Value

     $path = [System.IO.Path]
    $settings = $path::Combine($path::GetDirectoryName($project.FileName), "Settings\settings.xml")


    $settingsfile = $project.ProjectItems.Item("Settings").ProjectItems.Item("settings.xml")

    $settingsfile.Name = ($rootnamespace + 'Settings.xml')
+10
source

All Articles