Per Framework Content

Apr 4, 2011 at 5:47 PM

I have a scenario where I need to copy different source code based on the version of .NET that the package is being installed into. I need to make transformations on the source code as well. Is this supported? Can I just use the same folder structure under content as lib?

Apr 4, 2011 at 5:58 PM

No, we don't currently support that. There's a bug logged on that in our backlog:

Apr 4, 2011 at 6:10 PM

This isn't supported as yet but we have an issue tracking it:


Apr 4, 2011 at 6:37 PM

In the mean time, how would you recommend I proceed?

Apr 4, 2011 at 6:38 PM

You can do some custom work in Install.ps1. I'd have to find some time to look into exactly *how* you would do it. It'll take some spelunking with $dte etc.

Apr 4, 2011 at 8:01 PM

I think we've got a reasonable solution worked out for the interim.  Thanks! I've voted up work item 221 as that will make things more maintainable for me in the future. Great work guys. The Caliburn.Micro community is really looking forward seeing the framework available on NuGet.

Apr 4, 2011 at 8:06 PM

Great! Is your solution something blog worthy as a tip for other NuGet users?

I’m glad it’s working out for you and hopefully we can make that part work better for you in the future. J


Apr 5, 2011 at 3:44 PM
Edited Apr 5, 2011 at 3:54 PM

Here's what we did. In the tools folder, we have platform-specific content folders. In the Install.ps1 we locate the appropriate folder, iterate the files and do some simple string replacement. Finally, we add the file to the solution. Here's the basic script:


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

function get-content-path($contentRoot) {
	$moniker = $project.Properties.Item("TargetFrameworkMoniker").Value
	$frameworkname = new-object System.Runtime.Versioning.FrameworkName($moniker)

	$id = $frameworkname.Identifier

	if($id -eq ".NETFramework") { $relative = "NET40" }
	elseif($id -eq "Silverlight" -and $frameworkname.Profile -eq "WindowsPhone") { $relative = "SL40-WP" }
	elseif($id -eq "Silverlight" ) { $relative = "SL40" }
	[System.IO.Path]::Combine($contentRoot, $relative)
$contentSource = get-content-path($rootPath + "\tools")
$defaultNamespace = $project.Properties.Item("DefaultNamespace").Value

ls $contentSource | foreach-object { 
	$content = [System.IO.File]::ReadAllText($_.FullName)
	$content = $content.Replace('$safeprojectname$', $defaultNamespace)
	$content | out-file $_.FullName


Our folders are as follows under tools:




Apr 5, 2011 at 4:04 PM

Very nice! If you don’t blog this, I will! Do you have a blog?

Apr 5, 2011 at 4:49 PM

Sure, I'll blog it. I'm on I'll see if I can get it up tonight.

Apr 9, 2011 at 12:46 AM

Here's the post:

Apr 9, 2011 at 12:50 AM

Very nice work!

sent from my mobile

On Apr 8, 2011 7:46 PM, "EisenbergEffect" <> wrote:
> From: EisenbergEffect
> Here's the post:
Apr 9, 2011 at 1:08 AM

Btw, the correct folder for WP7 project is SL3-WP.