-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Emit warning for projects detected in multiple drives #549
Emit warning for projects detected in multiple drives #549
Conversation
Output after reproducing the issue locally post-fix:
|
7aef943
to
4d0af15
Compare
4d0af15
to
f28434f
Compare
drives.Add(pathRoot); | ||
} | ||
} | ||
|
||
string solutionPath = project.FullPath.ToRelativePath(rootPath).ToSolutionPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jeffkl - Should multiple drives be detected before this section as well (as in, should this solution path, which is written to the stream, use absolute paths)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think detecting multiple drives is the right thing to do. Instead, if the drive that the current project is different from the drive that the solution file is being saved to, we need to use rooted absolute paths for that project's entry. If the project is on the same drive, the path should be relative. If one or more projects are on a different drive, then emit the warning. Does that sound right to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added a condition to detect whether the current project's drive is different from that of the solution file to ensure absolute paths are used if that differs, but I still needed to include the hasFullPath
check since that led to the ArgumentException
(the hierarchy includes a topmost-level folder that has "" for its absolute path).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Latest test output:
Microsoft Visual Studio Solution File, Format Version 12.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProjectA", "C:\src\test\slngen-vcxitems\ProjectA\ProjectA.vcxitems", "{369B6908-BF24-4C02-8BB0-4139FD699D1D}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProjectB", "ProjectB.vcxitems", "{905547D1-E9AF-4D80-8F83-2751E83D4557}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProjectA", "C:\src\test\slngen-vcxitems\ProjectA", "{18234187-1FD6-4D2F-A26A-F9FC5FD67E9E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "slngen-vcxitems", "C:\src\test\slngen-vcxitems", "{048D148C-0E53-4770-A80E-40E40B181400}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "C:\src\test", "{59CC9E02-BE3C-4BCD-96A1-3243B7D7036F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "C:\src", "{D275FB7E-3968-465B-9679-3E738EB5E583}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ProjectB", "..\ProjectB", "{642B108B-866B-4B78-AD36-FAF88B6ECD4E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{369B6908-BF24-4C02-8BB0-4139FD699D1D} = {18234187-1FD6-4D2F-A26A-F9FC5FD67E9E}
{18234187-1FD6-4D2F-A26A-F9FC5FD67E9E} = {048D148C-0E53-4770-A80E-40E40B181400}
{048D148C-0E53-4770-A80E-40E40B181400} = {59CC9E02-BE3C-4BCD-96A1-3243B7D7036F}
{59CC9E02-BE3C-4BCD-96A1-3243B7D7036F} = {D275FB7E-3968-465B-9679-3E738EB5E583}
{D275FB7E-3968-465B-9679-3E738EB5E583} = {BBAA5F6C-FCF6-4088-8AB6-C7650C6BE6AB}
{905547D1-E9AF-4D80-8F83-2751E83D4557} = {642B108B-866B-4B78-AD36-FAF88B6ECD4E}
{642B108B-866B-4B78-AD36-FAF88B6ECD4E} = {F8F3097E-FE30-46C8-B7CD-C73AEFE68DCE}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {D0FD770F-48DF-419B-9E83-07C49EEFFD41}
EndGlobalSection
GlobalSection(SharedMSBuildProjectFiles) = preSolution
EndGlobalSection
EndGlobal
93e2a06
to
e58a8bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
e58a8bb
to
3085741
Compare
Use absolute instead of relative paths when the folder in a solution file is on a different drive from the root solution path and emit warning, as discussed in #512.