今天用vs2005 做一个web 程序时发现当试图更改控件ID时,总是出现"The Directory Name is Invaild" 错误提示。
以前曾遇到一次,忘了如何解决了。于是上网搜了搜发现在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文件,内容类似如下:
<?xml version="1.0" encoding="utf-16"?>
<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>

3.删除有问题的website标记段
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