0

SharePoint makes it easy to deploy various resources via mapped folders in your Visual Studio project, e.g. Images mapped folder is where you put images needed by the project. My question is: where can I put 3rd party assemblies if I don't want them in GAC? Is BIN folder the right one? Are there any guidlines or best practices?

Background: I have a SharePoint project that has hardcoded filepaths to various assemblies that are used at runtime, e.g. "C:\Dir\Lib1.dll". I would like these assemblies to be deployed together with the project, so that the same filepath can be used regardless of the server the project is deployed to.

1

Get new assemblies.

If you cannot deploy dependent assemblies to the GAC, then you will forever be struggling to update SharePoint's various config files with entries required to direct the fusion loader to the correct place. And, once you do that, you will not be supported.

0

Although not a good practice in Software Development, in this case you can create a Batch file with simple DOS Commands. You can run this batch file post Build/Deploy every time of the project using Visual Studio. In Batch file you can create folders and copy the files to specific paths you have hard coded in you project.

Commands you can include:

  • MD // to create directories such as Dir in your above example
  • xcopy *.dll // to copy the dll files

In This way every time you Deploy/Build the solution, you can make sure your files are present at desired location.

You can also package these 3th party dlls along with your wsp. Help Link

Once again it's not good practice to hard code file name.

Please let me know if further explanation is needed.

  • While this would work, it could easily result in permission problems on mkdir. For this reason, I would prefer to have have the dlls contained in the hive, unless there's particular reason this would be a bad practice. – w128 Jul 7 '14 at 11:31
  • So what's exactly your question? you need to deploy 3th party dlls every time you deploy the project? and where always in GAC? Please elaborate – Varun Verma Jul 7 '14 at 11:36
  • Ideally, they would be deployed when the project is, because this makes handling them easier (similar to other resources such as images). What I want to avoid is precisely what you describe: creating new folder on the filesystem if instead a SharePoint mapped folder can be used. So basically I'd just like to know what folder in the hive (if any) ca be used to deploy the dlls to. This way, hardcoding would no longer be an issue, similar to when you e.g. provide a path to an image in a custom feature. Having filepaths available like this can be useful if you're doing e.g. reflection. :) – w128 Jul 7 '14 at 11:45
  • OKiz in short you need a Mapped folder for your dlls :)? – Varun Verma Jul 7 '14 at 11:48
  • Yes, pretty much this. :) – w128 Jul 7 '14 at 11:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.