Possible to link rather than install files for projects?

Feb 28, 2012 at 12:35 AM

Greetings,

Is it possible in a nuget package to install a file as a link?  I've read the spec and couldn't see any reference, but I might have misunderstood the terminology.

Take this approach for example, where CompanyAssemblyInfo.cs is used for all projects in a solution to share common attributes, and is added as a link rather than directly added to the project. We also use this approach for other shared files like strong name keys or assembly icon.

i.e. the file would be installed into the project as:

<Compile Include="..\packages\Company\lib\CompanyAssemblyInfo.cs">
<Link>Properties\CompanyAssemblyInfo.cs</Link>
</Compile>

Thanks
Si

Feb 28, 2012 at 12:57 AM

There's no support for this in NuGet. You might be able to do it with the DTE using an install.ps1 PowerShell hook, but I've never tried to add a link through the DTE, so I can't say for sure.

Feb 28, 2012 at 1:30 AM

Thanks for the prompt response Drew.

I'm also looking at using nuget for installing our strong name keyfile, which means adding <SignAssembly> and <AssemblyOriginatorKeyFile> elements to the project, so I might have to dig a little deeper into the bowels of nuget.

I read in the docs that each of the convention based root directories (tools, lib, content) infer files are copied into a project rather than a project being modified (adding links, elements, etc.), so hopefully if I create a different root directory this won't be copied across. Time to start playing :)