Hi I've got an issue with using TFS "Open from Source Control..." with solutions that use NuGet Package Restore. I discussed briefly with dotnetjunky on the Discussions board, suggested I raised an Issue.
So here is the detailed repro steps. This has been tried on several of my coleagues machines, they all get the same problem.
Environment:
Windows 7 client developer workstation running VS2010 Ultimate SP1, with NuGet Extension v1.7.30402.9028
Windows Server 2008 R2 Standard server running TFS 2010
1. Start VisualStudio 2010 Ultimate
2. Open the Team Explorer and connect to a Team Project
3. Choose File -> New Project, click on Class Library
4. Leave name as "ClassLibrary1" and leave default location, ensure "Add to source control" is ticked
5. Click OK
6. If it asks for locations in TFS Source Controlm locate an appropriate folder and click OK
7. Open the Solution Explorer
8. Right click on the solution and select "Enable NuGet Package Restore", confirm the question with "Yes"
9. Verify that the .nuget folder has been added to the solution in the Solution Explorer
10. Right click the project called ClassLibrary1 and select "Manage NuGet Packages..."
11. Click on Online, and search for Log4net
12. Find Log4net [1.2.11] and click "Install"
13. Close the NuGet package manager
14. Click the Save All button on the VS toolbar
15. Right click on the solution and select "Check In..."
16. Ensure all the project and solution files are checked, including the .nuget folder and files within
17. IMPORTANT: UNCHECK THE "packages" FOLDER AND ANY log4net FILE AND FOLDERS UNDERNEATH. WE DO NOT
WANT TO CHECK PACKAGES INTO TFS!
18. Click the Check In button
19. Verify that the padlocks have appeared on all the files, project and solution in the Solution Explorer
20. Open the Pending Changes window
21. Right click on one of the pending checkins and select "Undo..."
22. Check all items in the list and click "Undo Changes" (this ensures no package files are waiting to be checked into TFS)
23. Click File -> Close Solution
24. Open windows explorer
25. Navigate to the location where the ClassLibrary1 project was created
26. IMPORTANT: DELETE THE ENTIRE ClassLibrary1 FOLDER FROM YOUR HARD DRIVE. INCLUDING THE .SLN, packages folder, .nuget folder, EVERYTHING!!
27. Go back to VS2010
28. Click File -> Source Control -> Open From Source Control...
29. In the Source Control browser navigate to the folder containing ClassLibrary1.sln
30. Select ClassLibrary1.sln
31. Click OK
32. The system will start downloading the source from TFS
33. Error appears saying "One or more projects in the solution were not loaded correctly. Please see the Output Window for details." <=== THIS IS THE ISSUE THIS REPRO IS FOR!!!
34. Click OK
35. Open the Output window, show output from Solution contains the following:
c:\users\robinson2p\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1.csproj : error : Unable to read the project file 'ClassLibrary1.csproj'.
c:\users\robinson2p\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1.csproj(59,3): The imported project "c:\users\robinson2p\documents\visual studio 2010\Projects\ClassLibrary1\.nuget\nuget.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
36. Verify that ClassLibrary1 project is greyed out and says "(unavailable)" after the project name.
37. I double-checked and the .nuget folder and the NuGet.targets file is definitely checked in. Here is my .sln file for reference:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1.csproj", "{2FE73229-133C-49EB-8510-2A31110D4B99}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{5501FB8E-EB0E-42E4-92AB-64C93653CF19}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://ste11747:8080/tfs/enterprisedevelopment
SccLocalPath0 = .
SccProjectUniqueName1 = ClassLibrary1.csproj
SccLocalPath1 = .
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2FE73229-133C-49EB-8510-2A31110D4B99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FE73229-133C-49EB-8510-2A31110D4B99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FE73229-133C-49EB-8510-2A31110D4B99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FE73229-133C-49EB-8510-2A31110D4B99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
PLEASE NOTE I'VE ATTACHED A ZIP CONTAINING MY TEST PROJECT FOR REFERENCE
Comments: Hello, We are having the exact same issue. We had it in VS2010, upgraded, and are still having it in VS2012 Premium (Update 3). We are using Microsoft Team Foundation Server 2010 (30319.01) also. We've been struggling with this for weeks. Since it's a team environment, it's important for us to be able to use the "Open from source control" capabilities of Visual Studio. Can you offer any help? Thanks in advance, Dean Major Solutions Architect Western Reserve Group
So here is the detailed repro steps. This has been tried on several of my coleagues machines, they all get the same problem.
Environment:
Windows 7 client developer workstation running VS2010 Ultimate SP1, with NuGet Extension v1.7.30402.9028
Windows Server 2008 R2 Standard server running TFS 2010
1. Start VisualStudio 2010 Ultimate
2. Open the Team Explorer and connect to a Team Project
3. Choose File -> New Project, click on Class Library
4. Leave name as "ClassLibrary1" and leave default location, ensure "Add to source control" is ticked
5. Click OK
6. If it asks for locations in TFS Source Controlm locate an appropriate folder and click OK
7. Open the Solution Explorer
8. Right click on the solution and select "Enable NuGet Package Restore", confirm the question with "Yes"
9. Verify that the .nuget folder has been added to the solution in the Solution Explorer
10. Right click the project called ClassLibrary1 and select "Manage NuGet Packages..."
11. Click on Online, and search for Log4net
12. Find Log4net [1.2.11] and click "Install"
13. Close the NuGet package manager
14. Click the Save All button on the VS toolbar
15. Right click on the solution and select "Check In..."
16. Ensure all the project and solution files are checked, including the .nuget folder and files within
17. IMPORTANT: UNCHECK THE "packages" FOLDER AND ANY log4net FILE AND FOLDERS UNDERNEATH. WE DO NOT
WANT TO CHECK PACKAGES INTO TFS!
18. Click the Check In button
19. Verify that the padlocks have appeared on all the files, project and solution in the Solution Explorer
20. Open the Pending Changes window
21. Right click on one of the pending checkins and select "Undo..."
22. Check all items in the list and click "Undo Changes" (this ensures no package files are waiting to be checked into TFS)
23. Click File -> Close Solution
24. Open windows explorer
25. Navigate to the location where the ClassLibrary1 project was created
26. IMPORTANT: DELETE THE ENTIRE ClassLibrary1 FOLDER FROM YOUR HARD DRIVE. INCLUDING THE .SLN, packages folder, .nuget folder, EVERYTHING!!
27. Go back to VS2010
28. Click File -> Source Control -> Open From Source Control...
29. In the Source Control browser navigate to the folder containing ClassLibrary1.sln
30. Select ClassLibrary1.sln
31. Click OK
32. The system will start downloading the source from TFS
33. Error appears saying "One or more projects in the solution were not loaded correctly. Please see the Output Window for details." <=== THIS IS THE ISSUE THIS REPRO IS FOR!!!
34. Click OK
35. Open the Output window, show output from Solution contains the following:
c:\users\robinson2p\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1.csproj : error : Unable to read the project file 'ClassLibrary1.csproj'.
c:\users\robinson2p\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1.csproj(59,3): The imported project "c:\users\robinson2p\documents\visual studio 2010\Projects\ClassLibrary1\.nuget\nuget.targets" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
36. Verify that ClassLibrary1 project is greyed out and says "(unavailable)" after the project name.
37. I double-checked and the .nuget folder and the NuGet.targets file is definitely checked in. Here is my .sln file for reference:
Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "ClassLibrary1.csproj", "{2FE73229-133C-49EB-8510-2A31110D4B99}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{5501FB8E-EB0E-42E4-92AB-64C93653CF19}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.exe = .nuget\NuGet.exe
.nuget\NuGet.targets = .nuget\NuGet.targets
EndProjectSection
EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 2
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://ste11747:8080/tfs/enterprisedevelopment
SccLocalPath0 = .
SccProjectUniqueName1 = ClassLibrary1.csproj
SccLocalPath1 = .
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2FE73229-133C-49EB-8510-2A31110D4B99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FE73229-133C-49EB-8510-2A31110D4B99}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FE73229-133C-49EB-8510-2A31110D4B99}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2FE73229-133C-49EB-8510-2A31110D4B99}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
PLEASE NOTE I'VE ATTACHED A ZIP CONTAINING MY TEST PROJECT FOR REFERENCE
Comments: Hello, We are having the exact same issue. We had it in VS2010, upgraded, and are still having it in VS2012 Premium (Update 3). We are using Microsoft Team Foundation Server 2010 (30319.01) also. We've been struggling with this for weeks. Since it's a team environment, it's important for us to be able to use the "Open from source control" capabilities of Visual Studio. Can you offer any help? Thanks in advance, Dean Major Solutions Architect Western Reserve Group