@@ -168,11 +168,26 @@ public string AbsolutePath
168
168
{
169
169
if ( _absolutePath == null )
170
170
{
171
+ _absolutePath = Path . Combine ( ParentSolution . SolutionFileDirectory , _relativePath ) ;
172
+
173
+ // For web site projects, Visual Studio stores the URL of the site as the relative path so it cannot be normalized.
174
+ // Legacy behavior dictates that we must just return the result of Path.Combine()
175
+ if ( ! Uri . TryCreate ( _relativePath , UriKind . Absolute , out Uri _ ) )
176
+ {
177
+ try
178
+ {
171
179
#if NETFRAMEWORK && ! MONO
172
- _absolutePath = Path . GetFullPath ( Path . Combine ( ParentSolution . SolutionFileDirectory , _relativePath ) ) ;
180
+ _absolutePath = Path . GetFullPath ( _absolutePath ) ;
173
181
#else
174
- _absolutePath = FileUtilities . NormalizePath ( Path . Combine ( ParentSolution . SolutionFileDirectory , _relativePath ) ) ;
182
+ _absolutePath = FileUtilities . NormalizePath ( _absolutePath ) ;
175
183
#endif
184
+ }
185
+ catch ( Exception )
186
+ {
187
+ // The call to GetFullPath() can throw if the relative path is some unsupported value or the paths are too long for the current file system
188
+ // This falls back to previous behavior of returning a path that may not be correct but at least returns some value
189
+ }
190
+ }
176
191
}
177
192
178
193
return _absolutePath ;
@@ -229,9 +244,9 @@ public IReadOnlyDictionary<string, ProjectConfigurationInSolution> ProjectConfig
229
244
230
245
internal string TargetFrameworkMoniker { get ; set ; }
231
246
232
- #endregion
247
+ #endregion
233
248
234
- #region Methods
249
+ #region Methods
235
250
236
251
private bool _checkedIfCanBeMSBuildProjectFile ;
237
252
private bool _canBeMSBuildProjectFile ;
@@ -529,13 +544,13 @@ private static bool ElementContainsInvalidNamespaceDefitions(XmlElement mainProj
529
544
return false ;
530
545
}
531
546
532
- #endregion
547
+ #endregion
533
548
534
- #region Constants
549
+ #region Constants
535
550
536
551
internal const int DependencyLevelUnknown = - 1 ;
537
552
internal const int DependencyLevelBeingDetermined = - 2 ;
538
553
539
- #endregion
554
+ #endregion
540
555
}
541
556
}
0 commit comments