{"id":337,"date":"2019-11-20T12:25:56","date_gmt":"2019-11-20T12:25:56","guid":{"rendered":"http:\/\/yer.ac\/blog\/?p=337"},"modified":"2020-02-07T16:14:48","modified_gmt":"2020-02-07T16:14:48","slug":"identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution","status":"publish","type":"post","link":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/","title":{"rendered":"Identifying Nuget package references which are using relative paths across whole solution"},"content":{"rendered":"\n<p>Keeping up with a recent binge upgrading projects, including <a href=\"http:\/\/yer.ac\/blog\/2019\/11\/06\/pragmatically-upgrading-net-framework-version-for-all-projects-with-powershell\/\">upgrading all my projects in a solution<\/a> to 4.8, I have been upgrading nuget packages. Whilst this is a relatively simple task, what irks me is that when you add or upgrade a nuget package in Visual Studio, it will often change the package path to be relative to the project file.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">What does the issue look like?<\/h4>\n\n\n\n<p>When we do something like <code>Install-Package EntityFramework -Version 6.3.0 <\/code> we end up with something like this in the CSPROJ<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"979\" height=\"62\" data-attachment-id=\"338\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/image-25\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?fit=979%2C62&amp;ssl=1\" data-orig-size=\"979,62\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?fit=700%2C44&amp;ssl=1\" src=\"https:\/\/i1.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?fit=700%2C44\" alt=\"\" class=\"wp-image-338\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?w=979&amp;ssl=1 979w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?resize=300%2C19&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?resize=700%2C44&amp;ssl=1 700w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image.png?resize=768%2C49&amp;ssl=1 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/figure>\n\n\n\n<p>As we can see, the <code>&lt;HintPath&gt;<\/code> is using a relative path based on the project file location to the solution file (As packages are kept under \/Packages at the same level of the .sln)<\/p>\n\n\n\n<p><strong>Why is this a problem? <\/strong>Although it could &#8220;just work&#8221; for some scenarios, if there are shared libraries which are used across different solutions we can end up with a build failure due to missing packages!  Ideally, the hint path should start with <code>$(SolutionDir)packages\\<\/code> so the correct package will be located regardless of the solution being built.<\/p>\n\n\n\n<p>There are workarounds to stop this occurring (I had varied results), but this doesn&#8217;t really solve the issue of retrospectively locating all the places this has happened!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Identifying all references which use relative paths<\/h4>\n\n\n\n<p>My solution has close to a hundred projects nested within it, so a manual check could be problematic and prone to human error.<\/p>\n\n\n\n<p>Below is a snippet that will take a Solution file, and for each project check for any hint path which does not contain <code>$($SolutionDir)<\/code> providing the directory and solution name are changed.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Wabbbit\/3d8d6fddffa35334ef7d8c0d3cd9c063\/6e2e9a13a62326860b826f039e9d2855158979cd.js\"><\/script>\n\n\n\n<p>Once the script runs it will output any projects and hint paths that may be an issue. For me it was simply going over these one by one and changing everything before \\Packages (i..e &#8230;\\..\\..\\somefolder\\Packages\\) to  use the solution directory variable &#8211; i.e. <code>$(SolutionDir)\\Packages<\/code><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Creating a helper in Visual Studio<\/h4>\n\n\n\n<p>Although the snippet above will quickly identify  any potential issues, it&#8217;s not very reusable as you have to change the paths for each solution.<\/p>\n\n\n\n<p>One thing we can do is add a custom tool into Visual Studio to execute the Powershell on demand for the given solution.<\/p>\n\n\n\n<p>To do this, first save the script in the snippet below to your own system. Note this is slightly different to the script above as it takes in a parameter.<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/Wabbbit\/3d8d6fddffa35334ef7d8c0d3cd9c063.js\"><\/script>\n\n\n\n<p>Once this is done, go to Visual Studio -&gt; Tools -&gt; External Tools -&gt; Add<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"455\" height=\"453\" data-attachment-id=\"340\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/image-1-5\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-1.png?fit=455%2C453&amp;ssl=1\" data-orig-size=\"455,453\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-1.png?fit=455%2C453&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-1.png?resize=455%2C453\" alt=\"\" class=\"wp-image-340\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-1.png?w=455&amp;ssl=1 455w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-1.png?resize=300%2C300&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-1.png?resize=150%2C150&amp;ssl=1 150w\" sizes=\"auto, (max-width: 455px) 100vw, 455px\" \/><\/figure><\/div>\n\n\n\n<p>In here we can make a new external tool called something like &#8220;Find Bad References&#8221;.<\/p>\n\n\n\n<p><strong>Command:<\/strong> Path to the system Powershell executable. <code>C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe<\/code><\/p>\n\n\n\n<p><strong>Arguments:  <\/strong><code>-file \"C:\\Path\\To\\File.ps1\" $(SolutionFileName)<\/code><\/p>\n\n\n\n<p><strong>Initial Directory: <\/strong><code>$(SolutionDir)<\/code><\/p>\n\n\n\n<p><strong>Use Output Window<\/strong>: Checked<\/p>\n\n\n\n<p>Now, once saved we should have a new option under tools with the same name as the provided title.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"376\" height=\"382\" data-attachment-id=\"341\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/image-2-6\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&amp;ssl=1\" data-orig-size=\"376,382\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-2\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?resize=376%2C382\" alt=\"\" class=\"wp-image-341\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?w=376&amp;ssl=1 376w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?resize=295%2C300&amp;ssl=1 295w\" sizes=\"auto, (max-width: 376px) 100vw, 376px\" \/><\/figure><\/div>\n\n\n\n<p>Once clicked, it will execute the script and provide results (if any) in the output tab.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Final thoughts<\/h2>\n\n\n\n<p>This isn&#8217;t great, and there are plugins that do similar things already, hell, some may even automatically fix these issues! This was designed to scan and generate the potential issues for a manual verification. Feel free to improve it and let me know!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Keeping up with a recent binge upgrading projects, including upgrading all my projects in a solution to 4.8, I have been upgrading nuget packages. Whilst this is a relatively simple task, what irks me is that when you add or upgrade a nuget package in Visual Studio, it will often change the package path to &hellip;<\/p>\n","protected":false},"author":1,"featured_media":341,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[6,7],"tags":[29],"class_list":["post-337","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-development","category-devops","tag-nuget"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Identifying Nuget package references which are using relative paths across whole solution - yer.ac | Adventures of a developer, and other things.<\/title>\n<meta name=\"description\" content=\"Fixing relative hintpath in nuget dependancies across a solution file with PowerShell.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Identifying Nuget package references which are using relative paths across whole solution - yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"og:description\" content=\"Fixing relative hintpath in nuget dependancies across a solution file with PowerShell.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/\" \/>\n<meta property=\"og:site_name\" content=\"yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"article:published_time\" content=\"2019-11-20T12:25:56+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-07T16:14:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1\" \/>\n\t<meta property=\"og:image:width\" content=\"376\" \/>\n\t<meta property=\"og:image:height\" content=\"382\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"yer.ac\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"yer.ac\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/\"},\"author\":{\"name\":\"yer.ac\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"headline\":\"Identifying Nuget package references which are using relative paths across whole solution\",\"datePublished\":\"2019-11-20T12:25:56+00:00\",\"dateModified\":\"2020-02-07T16:14:48+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/\"},\"wordCount\":529,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image-2.png?fit=376%2C382&ssl=1\",\"keywords\":[\"Nuget\"],\"articleSection\":[\"Development\",\"DevOps\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/\",\"name\":\"Identifying Nuget package references which are using relative paths across whole solution - yer.ac | Adventures of a developer, and other things.\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image-2.png?fit=376%2C382&ssl=1\",\"datePublished\":\"2019-11-20T12:25:56+00:00\",\"dateModified\":\"2020-02-07T16:14:48+00:00\",\"description\":\"Fixing relative hintpath in nuget dependancies across a solution file with PowerShell.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image-2.png?fit=376%2C382&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/11\\\/image-2.png?fit=376%2C382&ssl=1\",\"width\":376,\"height\":382},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/11\\\/20\\\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Identifying Nuget package references which are using relative paths across whole solution\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\",\"name\":\"yer.ac | Adventures of a developer, and other things.\",\"description\":\"Blog to keep track of things I am upto\",\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/yer.ac\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\",\"name\":\"yer.ac\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"caption\":\"yer.ac\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Identifying Nuget package references which are using relative paths across whole solution - yer.ac | Adventures of a developer, and other things.","description":"Fixing relative hintpath in nuget dependancies across a solution file with PowerShell.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/","og_locale":"en_US","og_type":"article","og_title":"Identifying Nuget package references which are using relative paths across whole solution - yer.ac | Adventures of a developer, and other things.","og_description":"Fixing relative hintpath in nuget dependancies across a solution file with PowerShell.","og_url":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/","og_site_name":"yer.ac | Adventures of a developer, and other things.","article_published_time":"2019-11-20T12:25:56+00:00","article_modified_time":"2020-02-07T16:14:48+00:00","og_image":[{"width":376,"height":382,"url":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1","type":"image\/png"}],"author":"yer.ac","twitter_card":"summary_large_image","twitter_misc":{"Written by":"yer.ac","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#article","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/"},"author":{"name":"yer.ac","@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"headline":"Identifying Nuget package references which are using relative paths across whole solution","datePublished":"2019-11-20T12:25:56+00:00","dateModified":"2020-02-07T16:14:48+00:00","mainEntityOfPage":{"@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/"},"wordCount":529,"commentCount":0,"publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"image":{"@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1","keywords":["Nuget"],"articleSection":["Development","DevOps"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/","url":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/","name":"Identifying Nuget package references which are using relative paths across whole solution - yer.ac | Adventures of a developer, and other things.","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#primaryimage"},"image":{"@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#primaryimage"},"thumbnailUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1","datePublished":"2019-11-20T12:25:56+00:00","dateModified":"2020-02-07T16:14:48+00:00","description":"Fixing relative hintpath in nuget dependancies across a solution file with PowerShell.","breadcrumb":{"@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#primaryimage","url":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1","contentUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1","width":376,"height":382},{"@type":"BreadcrumbList","@id":"https:\/\/yer.ac\/blog\/2019\/11\/20\/identifying-nuget-package-references-which-are-using-relative-paths-across-whole-solution\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/yer.ac\/blog\/"},{"@type":"ListItem","position":2,"name":"Identifying Nuget package references which are using relative paths across whole solution"}]},{"@type":"WebSite","@id":"https:\/\/yer.ac\/blog\/#website","url":"https:\/\/yer.ac\/blog\/","name":"yer.ac | Adventures of a developer, and other things.","description":"Blog to keep track of things I am upto","publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/yer.ac\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d","name":"yer.ac","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","caption":"yer.ac"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/11\/image-2.png?fit=376%2C382&ssl=1","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paP5IW-5r","jetpack-related-posts":[{"id":303,"url":"https:\/\/yer.ac\/blog\/2019\/09\/05\/dotnet-pack-project-reference-and-nuget-dependency\/","url_meta":{"origin":337,"position":0},"title":"Include both Nuget Package References and project reference DLL using &#8220;dotnet pack&#8221; \ud83d\udce6","author":"yer.ac","date":"September 5, 2019","format":false,"excerpt":"Recently I have been trying to generate more Nuget packages for our dotnet core projects, utilizing the dotnet pack command. One issue I have been encountering is that the command was either referencing the required nuget packages, or the project reference DLLs, never both. The current problem. If you have\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/09\/image-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/09\/image-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/09\/image-1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":521,"url":"https:\/\/yer.ac\/blog\/2021\/10\/06\/vs2019-2022-keeps-asking-for-azure-devops-credentials-on-build\/","url_meta":{"origin":337,"position":1},"title":"VS2019 (+2022) keeps asking for Azure Devops Credentials on build","author":"yer.ac","date":"October 6, 2021","format":false,"excerpt":"We run our own nuget feed via Azure, and despite the user that's logged into VS is authenticated users are constantly asked to provide their credentials again when package restore is happening. A quick fix below - Mostly so I don't forget or can forward this to others later. Verify\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/yer.ac\/blog\/category\/development\/azure\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":333,"url":"https:\/\/yer.ac\/blog\/2019\/11\/06\/pragmatically-upgrading-net-framework-version-for-all-projects-with-powershell\/","url_meta":{"origin":337,"position":2},"title":"Pragmatically upgrading .net framework version for  all projects with PowerShell","author":"yer.ac","date":"November 6, 2019","format":false,"excerpt":"We had a situation where we needed to upgrade all the CSPROJ files in a solution to 4.8. The issue is that some of our solutions contain almost a hundred projects so a manual intervention would be prone to error. (plus we have multiple solutions to apply this against!) Whilst\u2026","rel":"","context":"In &quot;DevOps&quot;","block_context":{"text":"DevOps","link":"https:\/\/yer.ac\/blog\/category\/devops\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":8,"url":"https:\/\/yer.ac\/blog\/2019\/03\/19\/my-attempt-at-using-sonarqube-for-static-code-analysis\/","url_meta":{"origin":337,"position":3},"title":"My attempt at using SonarQube for static code analysis","author":"yer.ac","date":"March 19, 2019","format":false,"excerpt":"This post covers my attempts to use SonarQube as a stand-alone install to perform static code analysis on a regular basis. This will cover purely getting the tool working, Maybe I will pick up how I can use the data in a later post? I will be doing this in\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image.png?resize=1050%2C600&ssl=1 3x"},"classes":[]},{"id":527,"url":"https:\/\/yer.ac\/blog\/2023\/03\/23\/polymorphic-serialization-deserialziation-of-interface-implementations-in-net6\/","url_meta":{"origin":337,"position":4},"title":"Polymorphic Serialization &#038; Deserialziation of Interface implementations in dotnet","author":"yer.ac","date":"March 23, 2023","format":false,"excerpt":"I will preface this by saying this is not a good idea and was more of a \"I wonder..\", as you lose the benefit of a descriptive model (especially in swagger), and its somewhat brittle if you add more types. Honestly it started as a \"It would be nice if\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":151,"url":"https:\/\/yer.ac\/blog\/2019\/05\/29\/remote-nlog-logging-with-azure-functions-part-two-persisting-data-into-azure-cosmos-db\/","url_meta":{"origin":337,"position":5},"title":"Remote NLOG logging with Azure Functions (Part two) &#8211; Persisting data into Azure Cosmos DB.","author":"yer.ac","date":"May 29, 2019","format":false,"excerpt":"Last time, I got a very basic C# Azure Function hooked up to accept a request from an NLOG web service target. This time, I will be attempting to persist(insert) the incoming log information into an Azure Cosmos database container, direct from my Azure Function in VS Code. Disclaimer: This\u2026","rel":"","context":"In &quot;Azure&quot;","block_context":{"text":"Azure","link":"https:\/\/yer.ac\/blog\/category\/development\/azure\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=700%2C400&ssl=1 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/05\/image-12.png?resize=1050%2C600&ssl=1 3x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/comments?post=337"}],"version-history":[{"count":5,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/337\/revisions"}],"predecessor-version":[{"id":345,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/337\/revisions\/345"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/media\/341"}],"wp:attachment":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/media?parent=337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/categories?post=337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/tags?post=337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}