How to avoid getting "Unable to read the project file" error message in Visual Studio 2003?

dreamchaser23
dreamchaser23 used Ask the Experts™
on
Hi Experts,
Everytime I open my solution in Visual Studio 2003, I get
"Unable to read the project file 'ProjectName1.csproj'. The system cannot find the path specified."

It happens for 2 projects but all other projects get loaded properly.

Even though, I delete the projects and "Add Existing Project" to the solution, it lasts as long as I dont close the solution.

Everyday when I open Visual Studio 2003, I've got to delete the 2 projects and add them once again.
They are indeed linked to source control (Visual Source Safe) just like other projects. They are also present in the same folder as the other projects

Can someone tell me what I have to do to overcome this issue?

Any comments will be greatly appreciated.

Thanks in advance,
DreamChaser
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
Once you remove and readd the file, make sure you check in the root of your solution.  Project references are contained in the solution file, and if you are not checking it in and doing a full get in the morning chances are you keep blowing away the fixed references.

Author

Commented:
Thanks for your reply, Nash2334
You are right.

But, Whenever I try to check in the solution, it prompts

"None of the items in this selection is valid for this operation."

I tried to check out the root solution, and then check in once again.

After that, I closed the solution, opened it once again.

Again it prompts the same error:

"Unable to read the project file...."

I dunno why this happens. I never had this error before.
Top Expert 2007
Commented:
The *.sln file does hold the project references...but is sounds like the problem is within the *.csproj files....

Are the "lost projects" web apps? if yes...chances are your local IIS is not mapped the same way as the csproj file is mapped in the SourceSafe version...

>>But, Whenever I try to check in the solution, it prompts
>>"None of the items in this selection is valid for this operation."

I think you only get that error if nothing is actually checked out.
Try using SourceSafe (instead of VS) to manually check out the main *.sln file and the affected *.csproj files
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

Commented:
When you update the project references the solution file should be automatically checked out and updated for you, so I would go down that path again: get the latest version from VSS, then update the project references by removing and re-adding them the way you already have.  You should see a checkmark at the root of your solution after this is done indicating that the solution file is checked out.  You should then check everything in at the root level, e.g. right-click the solution and check in; this should update the solution file in VSS.

Author

Commented:
Hi samtran0331
Many Thanks for your comment.

Yeah you are absolutely right.

The lost projects are the web projects

How do I chk the IIS mapping?

Hey one more thing: Some days back, for these web projects C:\wwwroot\inetpub\ProjectName was the project folder.

and whenever I ran the app, I get HTTP 401 Access Denied error mesgs. So I deleted all these folders and got the latest version from VSS.

Now I have the web projects in the same folder location as the other projects. Now I dont get the HTTP 401 mesgs. But these projects are getting lost everytime I close the solution.

As you said, this could be the reason. Could you please let me know how to solve this.

Thanks again samtran0331.
Top Expert 2007
Commented:
>>Now I have the web projects in the same folder location as the other projects. Now I dont get the HTTP 401 mesgs. But these projects are getting lost everytime I close the solution.

this is exactly what I'm talking about with "lost IIS mappings"...
VS2003 web apps kept track of the IIS location of the project in the "appname.csproj.webinfo"
when you open a solution that contains web projects, VS checks that the app is running at the address specified in the webinfo file.
if there is no virtual directory there, it won't load the project (which sounds like what is happening)

Do a get latest.
Look in your project folder for the "appname.csproj.webinfo" file, right-click and "open with" Notepad.
It should look like:
<VisualStudioUNCWeb>
    <Web URLPath = "http://localhost/projectname/projectname.csproj" />
</VisualStudioUNCWeb>


make sure that your IIS virtual directory is the same name at the same address:
http://localhost/projectname/

and that the folder you mapped the virtual directory to contains the .csproj file in question.

**It's possible that if you start changing these files now, that it will screw up the other developers!
I would suggest you look at a different developer's computer (who isn't having this problem) and make your IIS look just like his/her IIS.

Author

Commented:
Hi samtran0331,
Thanks again for your comment!

>><VisualStudioUNCWeb>
>>    <Web URLPath = "http://localhost/projectname/projectname.csproj" />
>></VisualStudioUNCWeb>

This is exactly how I have in my webinfo files in both projects.

>>make sure that your IIS virtual directory is the same name at the same address:

I went into IIS (inetmgr), right clicked the project name, properties, local path points to the correct location of the project

did the same thing for the other project. It also refers to the correct folder location, where the rest of the projects are present.

Is this what you wanted me to do? Or something else, samtran?

Please let me know!

Thanks
DreamChaser

Author

Commented:
Hi Nash2334,

Thanks a lot for your reply.

Actually two of my projects dont get loaded. Not the references. (sorry if I had presented you a wrong picture)

Even if I delete the unloaded projects and add them again, there is no checkmark icon on the Solution.

That's why I am not able to check in.

I tried samtran's solution to check out in VSS, then add the projects, and then check in VSS.

But unfortunately it doesnt work either.

If I edit any file in these projects and then check in the root solution, these changes get saved to the VSS. But if I close the solution, and then open it again, its the same story!

Thanks once again for your reply Nash
Top Expert 2007

Commented:
Also open your sln file in Notepad, you should see some http:// paths in there also that point to your project....are those pointing to the right place?

Author

Commented:
Hi Samtran0331,
In the sln file,
All the projects are like this:
Project("{Alpha_Numbers_Here}") = "ProjectName1", "ProjectName1\ProjectName1.csproj", "{Alpha_Numbers_Here}"
      ProjectSection(ProjectDependencies) = postProject
      EndProjectSection
EndProject

All Web Projects are like this:
Project("{Alpha_Numbers_Here}") = "WebProjectName1", "http://localhost/WebProjectName1/WebProjectName1.csproj", "{Alpha_Numbers_Here}"
      ProjectSection(ProjectDependencies) = postProject
      EndProjectSection
EndProject

Does it seem correct to you?


In this section:

Global
      GlobalSection(SourceCodeControl) = preSolution
            SccNumberOfProjects = 7
No of Projects mentioned is 7. Actually I have 9 (The 2 web projects are left out here:((

Should I add the entries here, Samtran?

Thanks again for your comment!
Top Expert 2007

Commented:
I wouldn't add them manually...what I don't understand is why when you re-add the projects to your solution, they aren't saved to the solution file....and why when you delete/re-add the projects that the file isn't getting checked out by SourceSafe...

you're sure the "working folder" set in SourceSafe is the one you're dealing with on your local machine?

Author

Commented:
Thanks for the comment, Samtran.
really Sorry for my delayed response.

Well, everytime I get the latest version from SourceSafe, I used to click on "Browse" button and point to

the folder location that I use. By default it doesnt point to the correct location. For eg: it points to

C:\Apps\ProjectName and I have the project in C:\CSharp\Apps\ProjectName.

So everytime I get latest version, I get into C:\CSharp\Apps\ProjectName

Yes you are right, the path in the sourcesafe is $/Apps/ProjectName, while the path that I use is C:\CSharp\Apps\ProjectName

As I told you earlier, before when I was getting HTTP 401 Access Denied Error messages, I had the project files in C:\wwwroot\inetpub

When I removed them and referred to the location where I have other projects, I started getting

this "Unable to ..." error, but stopped getting  HTTP 401 Access Denied Error messages.

I dont use this app everyday, so is it fine if I just remove and add the projects whenever I want to run? I

am able to check in and check out the files in these 2 projects to sourcesafe properly.

What would you recommend, samtran0331?

Please let me know. Thanks again for all your responses.

Author

Commented:
Correction:::
This line in the previous post:

So everytime I get latest version, I get ALL THE FILES into C:\CSharp\Apps\ProjectName
Top Expert 2007
Commented:
>>so is it fine if I just remove and add the projects whenever I want to run? I
>>am able to check in and check out the files in these 2 projects to sourcesafe properly.

It seems like since you aren't modifying the sln or csproj files in SourceSafe, you aren't causing any other developers any problems. And as long as when you change and save files in the project that you know for sure they get back into SourceSafe...then I guess it is ok to remove/re-add them every time (but I'm sure it's quite annoying)

If you can get back to the point where Visual  Studio and SourceSafe worked and the problem was the 401 error, I would maybe try to fix the 401 error in IIS.

Sorry we couldn't be of more help!

Author

Commented:
>>>...then I guess it is ok to remove/re-add them every time (but I'm sure it's quite annoying)

Thanks for the confirmation mate.

Well, its not gonna be more than 3 or 4 times a week. Plus the entire addition process takes around 30 secs. I am gonna bear with it for now.

I really dont know how someone got the project files to C:\wwwroot\inetpub ane managed to sync it to VSS. Sorry but I dont think I can replicate this mate. But many thanks for the offer.

Ok.. Lemme grade your excellent solution guys.
Thanks again Samtran0331 and Nash2334


Author

Commented:
By any chance, could you please look these questions, guys? provided you get a chance (and time)
Thanks again..
http://www.experts-exchange.com/Programming/Languages/C_Sharp/Q_22912315.html

http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_22841218.html

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial