如何从 VS 网站删除 VSS 挂钩?

发布于 2024-07-11 16:13:09 字数 1344 浏览 10 评论 0原文

我有一个 Visual Studio 2008 解决方案,其中包含 7 个不同的项目。 其中 3 个“项目”是网站(没有项目文件的项目类型)。

我已从所有目录中删除了所有各种 Visual Sourcesafe 文件,删除了 SLN 文件中的 Scc 引用以及所有存在的项目文件。 我还删除了 SUO 文件和所有 USER 文件。 Visual Studio 仍然认为其中 2 个网站仍处于源代码控制之下,并且它为我将 Scc 条目添加回 SLN 文件中。

有人知道VS如何仍然了解旧的源代码控制吗?

编辑: 我没有提到的另一件事是,我试图从中删除 VSS 挂钩的文件已被复制到 VSS 的已知工作目录之外,Python 脚本运行以及在 VS 2008 中打开解决方案之前对文件进行的手动编辑或VS 2005(我两者都有问题)。

这是一个 python 脚本,我用它来清除这些文件,并让我知道哪些文件需要手动编辑。

import os, stat
from os.path import join

def main():
  startDir = r"C:\Documents and Settings\user\Desktop\project"

  manualEdits = []

  for root, dirs, files in os.walk(startDir, topdown=False):
    if '.svn' in dirs:
      dirs.remove('.svn')
    for name in files:
      os.chmod(join(root,name), stat.S_IWRITE)
      if name.endswith(".vssscc") or name.endswith(".scc") or name.endswith(".vspscc") or name.endswith(".suo") or name.endswith(".user"):
        print "Deleting:", join(root, name)
        os.remove(join(root,name))
      if name.endswith("sln") or name.endswith("dbp") or name.endswith("vbproj") or name.endswith("csproj"):
        manualEdits.append(join(root, name))

  print "Manual Edits are needed for these files:"
  for name in manualEdits:
    print name

if __name__ == "__main__":
  main()

I have a Visual Studio 2008 solution with 7 various projects included with it. 3 of these 'projects' are Web Sites (the kind of project without a project file).

I have stripped all the various Visual Sourcesafe files from all the directories, removed the Scc references in the SLN file and all the project files that exist. I deleted the SUO file and all the USER files also. Visual Studio still thinks that 2 of the Web Sites are still under source control, and it adds the Scc entries back into the SLN file for me.

Does anybody know how VS still knows about the old source control?

Edit:
Another thing that I didn't mention is that the files I'm trying to remove VSS hooks from has been copied outside of VSS's known working directories, the python script run and manual edits to files made before the solution is opened in VS 2008 or VS 2005 (I had the problem with both).

Here is a python script that I used to weed out these files and let me know which files needed manually edited.

import os, stat
from os.path import join

def main():
  startDir = r"C:\Documents and Settings\user\Desktop\project"

  manualEdits = []

  for root, dirs, files in os.walk(startDir, topdown=False):
    if '.svn' in dirs:
      dirs.remove('.svn')
    for name in files:
      os.chmod(join(root,name), stat.S_IWRITE)
      if name.endswith(".vssscc") or name.endswith(".scc") or name.endswith(".vspscc") or name.endswith(".suo") or name.endswith(".user"):
        print "Deleting:", join(root, name)
        os.remove(join(root,name))
      if name.endswith("sln") or name.endswith("dbp") or name.endswith("vbproj") or name.endswith("csproj"):
        manualEdits.append(join(root, name))

  print "Manual Edits are needed for these files:"
  for name in manualEdits:
    print name

if __name__ == "__main__":
  main()

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

执笏见 2024-07-18 16:13:09

它可能只是尝试将其添加到您的 VS 实例上。 您必须删除缓存,以便 VS 认为它不再位于

  1. 文件下的 SS 下 -> 源控制-> 工作区
  2. 选择 SS 位置
  3. 编辑
  4. 选择工作文件
  5. 夹 删除!

It probably is only trying to add it on your instance of VS. You have to remove the cache so VS thinks its no longer under SS

  1. under file -> SourceControl -> Workspaces
  2. Select the SS location
  3. Edit
  4. Choose the working folder
  5. Remove!
就此别过 2024-07-18 16:13:09

这些东西都是有害的! Visual Studio 在任何地方都粘贴了 SourceSafe 的链接,包括构成 sln 文件的 XML 中。

我写了一篇文章,介绍我将 sourcesafe 转换为 subversion 的经验,并包含我使用的 python 脚本清理垃圾。 请注意:

1) 这是经过非常简单的测试。 进行备份,以免搞砸 sln/*proj 文件。 前后运行你的测试套件,以确保它没有搞砸什么(怎么可能?谁知道!但奇怪的事情发生了。)

2)这可能是考虑到不同版本的sourcesafe和Visual Studio,所以你可能需要调整它。 无论如何,事不宜迟:

import os, re

PROJ_RE = re.compile(r"^\s+Scc")
SLN_RE = re.compile(r"GlobalSection\(SourceCodeControl\).*?EndGlobalSection",
                    re.DOTALL)
VDPROJ_RE = re.compile(r"^\"Scc")

for (dir, dirnames, filenames) in os.walk('.'):
    for fname in filenames:
        fullname = os.path.join(dir, fname)
        if fname.endswith('scc'):
            os.unlink(fullname)
        elif fname.endswith('vdproj'):
            #Installer project has a different format
            fin = file(fullname)
            text = fin.readlines()
            fin.close()

            fout = file(fullname, 'w')
            for line in text:
                if not VDPROJ_RE.match(line):
                    fout.write(line)
            fout.close()
        elif fname.endswith('csproj'):
            fin = file(fullname)
            text = fin.readlines()
            fin.close()

            fout = file(fullname, 'w')
            for line in text:
                if not PROJ_RE.match(line):
                    fout.write(line)
            fout.close()
        elif fname.endswith('sln'):
            fin = file(fullname)
            text = fin.read()
            fin.close()

            text = SLN_RE.sub("", text)

            fout = file(fullname, 'w')
            fout.write(text)

Those things are pernicious! Visual Studio sticks links to SourceSafe in everywhere, including into the XML that makes up your sln file.

I wrote an article about my experiences converting sourcesafe to subversion, and included with it the python script that I used to clean out the junk. Please note:

1) This is VERY LIGHTLY TESTED. Make backups so you don't screw up your sln/*proj files. Run your test suite before and after to make sure it didn't screw up something (how could it? Who knows! but stranger things have happened.)

2) This may have been with a different version of sourcesafe and visual studio in mind, so you may need to tweak it. Anyway, without further ado:

import os, re

PROJ_RE = re.compile(r"^\s+Scc")
SLN_RE = re.compile(r"GlobalSection\(SourceCodeControl\).*?EndGlobalSection",
                    re.DOTALL)
VDPROJ_RE = re.compile(r"^\"Scc")

for (dir, dirnames, filenames) in os.walk('.'):
    for fname in filenames:
        fullname = os.path.join(dir, fname)
        if fname.endswith('scc'):
            os.unlink(fullname)
        elif fname.endswith('vdproj'):
            #Installer project has a different format
            fin = file(fullname)
            text = fin.readlines()
            fin.close()

            fout = file(fullname, 'w')
            for line in text:
                if not VDPROJ_RE.match(line):
                    fout.write(line)
            fout.close()
        elif fname.endswith('csproj'):
            fin = file(fullname)
            text = fin.readlines()
            fin.close()

            fout = file(fullname, 'w')
            for line in text:
                if not PROJ_RE.match(line):
                    fout.write(line)
            fout.close()
        elif fname.endswith('sln'):
            fin = file(fullname)
            text = fin.read()
            fin.close()

            text = SLN_RE.sub("", text)

            fout = file(fullname, 'w')
            fout.write(text)
新雨望断虹 2024-07-18 16:13:09

在您的 %APPDATA% 目录中,Visual Studio 保存了 Visual Studio 中使用的网站列表,以及该网站的一些设置:

在我的 Vista 计算机上,该文件的确切位置是

C:\Users\{name}\AppData\Local\Microsoft\WebsiteCache\Websites.xml

此文件包含类似条目

<?xml version="1.0" encoding="utf-16"?>
<DesignTimeData>
  <Website RootUrl="e:\Documents\Visual Studio 2008\WebSites\WebSite\"
      CacheFolder="WebSite" sccprovider="SubversionScc" scclocalpath="Svn"
      sccauxpath="Svn" addnewitemlang="Visual Basic" sccprojectname="Svn"
      targetframework="3.5" vwdport="60225" 
      _LastAccess="11-11-2008 10:58:03"/>
    <Website RootUrl="E:\siteje.webproj\" CacheFolder="siteje.webproj"
      _LastAccess="11-6-2008 14:43:45"/>
    <!-- And many more -->
</DesignTimeData />

正如您所看到的,它包含 Scc 引用这也是您的解决方案文件的一部分。
(在本例中,SCC 提供程序是 AnkhSVN 2.0,因此它不包含实际的 SCC 映射;只是一些告诉 SCC 提供程序查看工作副本的常量字符串)。

我认为尝试通过在多个位置缓存此信息来修复丢失的项目文件。 但如果该文件得到正确记录,那就太好了。

In your %APPDATA% directory Visual Studio saves a list of websites used in Visual Studio, with some settings of that site:

On my Vista Machine the exact location of the file is

C:\Users\{name}\AppData\Local\Microsoft\WebsiteCache\Websites.xml

This file contains entries like

<?xml version="1.0" encoding="utf-16"?>
<DesignTimeData>
  <Website RootUrl="e:\Documents\Visual Studio 2008\WebSites\WebSite\"
      CacheFolder="WebSite" sccprovider="SubversionScc" scclocalpath="Svn"
      sccauxpath="Svn" addnewitemlang="Visual Basic" sccprojectname="Svn"
      targetframework="3.5" vwdport="60225" 
      _LastAccess="11-11-2008 10:58:03"/>
    <Website RootUrl="E:\siteje.webproj\" CacheFolder="siteje.webproj"
      _LastAccess="11-6-2008 14:43:45"/>
    <!-- And many more -->
</DesignTimeData />

As you can see it contains the Scc references that are also part of your solution file.
(In this case the SCC provider is AnkhSVN 2.0, so it doesn't contain the actual SCC mapping; just some constant strings that tell the SCC provider to look at the working copy).

I think tried to fix the missing project file by caching this information in several locations. But it would be welcome if this file was properly documented.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文