file renaming when creating nuget packages

Topics: General
May 31, 2012 at 3:31 PM

Hi all,
I'm going to create a nuget package that will contain js scripts, and I would like to append the version to their name when I create the nuget package.
Example: the project contains file pippo.js, and I would like that it will be packaged as pippo-1.0.0.js.
The files to be included in the package are specified in the "files" element in the nuspec file.

I've read from docs that there is support for renaming, but I couldn't accomplish what I want.

I've tried <file src="scripts\**\*.*" target="content\scripts\*-$version$.*" /> in the nuspec file, but when I create the package I get the following error: Target path 'content\scripts\*-1.0.0.*' contains invalid characters.

Can you please help me?


May 31, 2012 at 3:42 PM

Doesn't work as of today. We do not pass in the property collection to our file resolution code. Feel free to file a bug \ send in a pull request

May 31, 2012 at 4:02 PM

Hi pranavkm,

thanks for your prompt answer.

If you could point me to where the file resolution happens, I will try to implement a fix.


May 31, 2012 at 4:11 PM

Look up ReadManifest in src\Core\Authoring\PackageBuilder.cs. This type receives a PropertyProvider that we use to populate the remaining manifest values. We would essentially need to preprocess the entire manifest file instead of specifically the metadata section.

May 31, 2012 at 5:42 PM

Well, it turns out that the manifest is actually fully processed, because in my attempts, by pure chance, I passed the basepath argument so PopulateFiles is called inside ReadManifest. :-)

Furthermore, from the error message, it looks like the $version$ token is correctly expanded, so the targetPath is "*-1.0.0.*".
As far as I can see from a quick look at the code, the actual problem seems to be in the way the target file names are generated, in the ResolveSearchPattern method in PathResolver class.
What do you think?