{"id":112966,"date":"2020-11-16T16:00:00","date_gmt":"2020-11-16T13:00:00","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-share-files-code-between-multiple-visual-studio-projects-with-symlinks-cloudsavvy-it\/"},"modified":"2020-11-16T16:00:00","modified_gmt":"2020-11-16T13:00:00","slug":"how-to-share-files-code-between-multiple-visual-studio-projects-with-symlinks-cloudsavvy-it","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-share-files-code-between-multiple-visual-studio-projects-with-symlinks-cloudsavvy-it\/","title":{"rendered":"#How To Share Files &#038; Code Between Multiple Visual Studio Projects (With Symlinks) \u2013 CloudSavvy IT"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_88 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6ac512eb82de2\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6ac512eb82de2\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-share-files-code-between-multiple-visual-studio-projects-with-symlinks-cloudsavvy-it\/#Linking_Files_Across_Projects\" >Linking Files Across Projects<\/a><\/li><\/ul><\/nav><\/div>\n<p><strong>&#8220;#How To Share Files &amp; Code Between Multiple Visual Studio Projects (With Symlinks) \u2013 CloudSavvy IT&#8221;<\/strong><\/p>\n<div id=\"article-content-area\">\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-5567\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/feb87ca042cbfee1b8caab6ebd08c90c\/p\/uploads\/2020\/07\/4e02f19e.png\" alt=\"\" width=\"700\" height=\"300\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Visual Studio \u201cSolutions\u201d are able to store multiple projects and assemblies. Usually, they\u2019re fairly separate, but what if you need to share code among them? One of the simplest ways to do this properly is with symlinks.<\/p>\n<h2 role=\"heading\" aria-level=\"2\"><span class=\"ez-toc-section\" id=\"Linking_Files_Across_Projects\"><\/span>Linking Files Across Projects<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>First, you should ask yourself if symlinks is really the best method to handle this. Sharing code between projects sounds like a great use case for just using an external class library. If you have that as an option, you should take it. Using symlinks would result in duplicate code in each assembly that references it. However, using an external class library usually comes with adding an extra DLL as a runtime dependency, which is a problem if you\u2019re referencing a lot of code.<\/p>\n<p>If it\u2019s just a single class file you need to reference in multiple places, using symlinks will make it easier to manage. You won\u2019t need to deal with the headache of copying files back and forth whenever you make changes. Each project will reference the same location on disk.<\/p>\n<p>Doing this is very simple. In the target location, right click the folder and select \u201cAdd &gt; Existing Item\u2026\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8003\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/b023e172ab0cfffd1f62d3282c2e2d20\/p\/uploads\/2020\/11\/926040fd.png\" alt=\"\" width=\"700\" height=\"163\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>Usually you\u2019d just press \u201cAdd,\u201d but in this case, you actually want to click the dropdown and select \u201cAdd As Link.\u201d<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-8004\" src=\"https:\/\/www.cloudsavvyit.com\/thumbcache\/0\/0\/497a007027228794661a8ae8c58aa881\/p\/uploads\/2020\/11\/c8ac60db.png\" alt=\"\" width=\"468\" height=\"161\" onload=\"pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\" onerror=\"this.onerror=null;pagespeed.lazyLoadImages.loadIfVisibleAndMaybeBeacon(this);\"\/><\/p>\n<p>That\u2019s really all there is to it\u2014the file should now be visible in both locations, and if you make changes to it from one place, it will reflect in the other. Really, there\u2019s only one file there, but when the assembly builds, it will include it in both assemblies.\n<\/p><\/div>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener noreferrer\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.cloudsavvyit.com\/8000\/how-to-share-files-code-between-multiple-visual-studio-projects-with-symlinks\/\" target=\"_blank\" rel=\"noopener noreferrer\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;#How To Share Files &amp; Code Between Multiple Visual Studio Projects (With Symlinks) \u2013 CloudSavvy IT&#8221; Visual Studio \u201cSolutions\u201d are able to store multiple projects and assemblies. Usually, they\u2019re fairly separate, but what if you need to share code among them? One of the simplest ways to do this properly is with symlinks. Linking Files&#8230;<\/p>\n","protected":false},"author":1,"featured_media":112967,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.cloudsavvyit.com\/p\/uploads\/2020\/07\/4e02f19e.png","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-112966","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/112966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=112966"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/112966\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/112967"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=112966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=112966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=112966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}