views:

400

answers:

2

Hello,

I noticed someone else asked a similar, if not exactly the same, question before, but the answer to it didn't help (me, anyway).

I have a project that I'm building a template from. When I go to reference an assembly in the Program Files, the template project itself will build fine, but any projects built off of it cannot find the referenced assembly. I tried editing the csproj directly, but that didn't work either. How do I reference non-GACed DLLs like that? Am I forced to use an IWizard trick?

A: 

Okay. You can do this by:

a) Reference your private assemblies in the appropriate folder on the hard-drive, e.g. where they're going to be installed b) Export the project as a template c) Extract the new zip file of the template d) Open the .vstemplate file e) At the bottom of the TemplateContent node, add a References node, and for each reference, add a Reference node as a child of References, then an Assembly node as a child of that, with the name of the assembly. If the assembly is in the GAC, I believe you need to put the fully-qualified assembly name, but otherwise, it seems to work with just the assembly name.

Originally, I'd set an environment path variable that should be searched; however, it ended up being unnecessary, as projects built on the template worked fine without it in the path.

By the way, this is the same as adding references for item templates. I tried it for this and it worked. I've tested it on my machine, but I'm going to give it a shot on a clean machine soon.
A: 

For Web Projects the best way I've found to handle this is to Include the Bin folder into the project with all the private assemblies in that folder. It's key that the Bin folder is included or else the folder won't copy.

Rick Strahl