如何解决Visual Studio 2005 "The Directory Name is Invaild" 错误
Posted on 2006-11-15 15:42 Patrick Zhang 阅读(2999) 评论(0) 编辑 收藏 举报以前曾遇到一次,忘了如何解决了。于是上网搜了搜发现在codeproject上一个老外也遇到同样问题,这是他的解决方法。
http://www.codeproject.com/useritems/VsPropRenameBug.asp
Workaround
1. Navigate to the directory..\Documents and Settings\<%UserName%>\Local Settings\Application Data\Microsoft\WebsiteCache
2. Create a folder with the same name as the name of your project
看到WebsiteCache ,突然想起上次如何解决这个问题。
1. 按上面路径找到WebsiteCache 目录
2. 打开Websites.xml文件,内容类似如下:
<DesignTimeData>
<Website RootUrl="http://Localhost/net2005test1/" CacheFolder="net2005test1" startpage="Default.aspx" addnewitemlang="Visual C#" addnewitemoptions="2" startaction="1" _LastAccess="10/18/2006 9:02:49 AM"/>
<Website RootUrl="http://Localhost/CssAdaptersTutorial/" CacheFolder="CssAdaptersTutorial" addnewitemlang="Visual C#" _LastAccess="11/1/2006 2:04:34 PM"/>
</DesignTimeData>
4.重新打开web程序在vs2005, 控件id可以更改,问题解决。
写道这里突然想到应到微软bug report查查, 果然是bug。会在vs下一版本或service pack里解决。
避免错误的方法就是不要同时用vs2005打开多个web程序,否则他们的cache 就晕了
http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=101992
This problem should only occur if you have multiple instances of the Visual Studio IDE open at the same time and then close one. You can avoid this problem by only having one instance open at a time.
A fix has been created for this bug. The fix will be in the next version of Visual Studio or possibly in a service pack. If this bug is significantly impacting your development you should contact Microsoft Product Support to request a hot fix.
Microsoft Web Development Tools Team
The underlying problem is that if the WebSiteCache directory for a specific web site is deleted this problem will occur. Once the directory is deleted it will continue to occur even if you reboot the machine.
There is a bug in Visual studio that when you have more than one instance of the IDE open and close a web-site it will delete the WebSiteCache directory of other web-sites. This is the common way to get into this situation. However, you could also get into the situation by deleting the directory manually (per the repro steps of this bug report.)
The quick fix is to make VS re-build the web site cache:
a) shut down all instances of VS
b) remove cache from command prompt> rd /s /q "%userprofile%\Local Settings\Application Data\Microsoft\WebsiteCache"
c) re-open your web site and the cache will be re-created
An alternative method to fix the one web site without deleteing the entire cache is the following:
a) shut down all instances of VS
b) open "%userprofile%\Local Settings\Application Data\Microsoft\WebsiteCache\websites.xml"
c) locate the entry for your web site and get its CacheFolder name. Usually the name of the web.
d) Ensure a sub-directory of that name exists under "%userprofile%\Local Settings\Application Data\Microsoft\WebsiteCache\"