以只读方式打开 Visual Studio 项目
场景:
我正在使用 svn:externals 从 CodePlex 获取 Microsoft.Practices.ServiceLocation。但是,在我自己的项目中引用 csproj 文件会导致从 2005 升级到 2008。这使得我的项目文件副本与基本副本不同,并且我无法从 subversion 更新项目。
...\deps\Microsoft.Practices.ServiceLocation 的更新导致:
Command Update
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ServiceLocatorProvider.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ServiceLocator.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\Readme.txt
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\Properties
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\Microsoft.Practices.ServiceLocation.csproj
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\IServiceLocator.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ActivationException.Desktop.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ActivationException.cs
Completed At revision: 43682
warning! One or more files are in a conflicted state.
...\deps 的更新导致:
Command Update
Completed At revision: 0
根目录的更新导致:
Command Update
External ...\deps\Microsoft.Practices.ServiceLocation
External failed ...\deps\Microsoft.Practices.ServiceLocation
Error Working copy '...\deps\Microsoft.Practices.ServiceLocation' locked
Error Please execute the 'Cleanup' command.
Completed ...\deps\Microsoft.Practices.ServiceLocation - at revision: 0
声称工作副本被锁定的混乱似乎是错误的,对 Microsoft.Practices.ServiceLocation 文件夹执行释放锁定会导致一条消息,指出“没有任何内容需要解锁。此工作副本中没有文件具有锁定”。如果我在根目录执行命令,结果相同。
执行清理没有任何改变。
我正在使用 TortoiseSVN。
- 我可以告诉 Visual Studio 2008 将项目/目录视为只读以避免升级吗?
- 我可以执行一个秘密的 Subversion 命令来让它工作吗?
- 为什么更新未更改的文件会导致树冲突?
编辑: 我用谷歌搜索了一些,发现 Subversion 文档解释了树冲突 http://svnbook.red-bean.com/nightly/en/svn.tour.treeconflicts.html。我改变了我的第三个问题,因为我不明白为什么在更新未更改的文件时会出现树冲突。
Scenario:
I'm using svn:externals to grab Microsoft.Practices.ServiceLocation from CodePlex. However, referencing the csproj-file in my own project causes an upgrade from 2005 to 2008. This makes my copy of the project file different from the base copy, and I am unable to update the project from subversion.
An update of ...\deps\Microsoft.Practices.ServiceLocation results in:
Command Update
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ServiceLocatorProvider.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ServiceLocatorImplBase.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ServiceLocator.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\Readme.txt
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\Properties
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\Microsoft.Practices.ServiceLocation.csproj
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\IServiceLocator.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ActivationException.Desktop.cs
Tree conflict ...\deps\Microsoft.Practices.ServiceLocation\ActivationException.cs
Completed At revision: 43682
warning! One or more files are in a conflicted state.
An update of ...\deps results in:
Command Update
Completed At revision: 0
An update of the root results in:
Command Update
External ...\deps\Microsoft.Practices.ServiceLocation
External failed ...\deps\Microsoft.Practices.ServiceLocation
Error Working copy '...\deps\Microsoft.Practices.ServiceLocation' locked
Error Please execute the 'Cleanup' command.
Completed ...\deps\Microsoft.Practices.ServiceLocation - at revision: 0
The messing claiming that the working copy is locked seems to be wrong, executing Release lock on the Microsoft.Practices.ServiceLocation folder results in a message stating "There's nothing to unlock. No file has a lock in this working copy." Same result if I execute the command at the root.
Executing a cleanup changed nothing.
I'm using TortoiseSVN.
- Can I tell Visual Studio 2008 to treat a project/directory as readonly to avoid an upgrade?
- Is there a secret Subversion command I can execute to get this to work?
- Why does an update of files that havnt changed cause a tree conflict?
Edit:
I've googled some, and found the Subversion documentation explaining tree conflicts at http://svnbook.red-bean.com/nightly/en/svn.tour.treeconflicts.html. I changed my third question since I dont understand why I'm getting a tree conflict when updating files that havnt changed.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
有多种选择,具体取决于您参与项目的程度以及您是否要更改项目。
对于我主要用于库的项目,我不会将开源项目放入我的解决方案中 - 只是将 dll 保存在我的源代码控制存储库中的库文件夹中。
调试时,您可以在 VS2008 中单步执行库的代码,而无需实际打开 2005 项目文件;所以不需要更新。
当我确实需要处理开源库的代码时,我会在它自己的解决方案中打开它。如果需要更新到 vs2008,我就让它更新——这没什么大不了的,因为只有项目文件发生了变化——而不是源代码。由于它位于源代码管理中,因此您始终可以将项目文件恢复为原始文件或重命名新副本并并排保留 2 个 csproj 文件。
我只在开源项目上使用 tortoise 进行 svn-update 并且不会发生冲突。 Svn 会将所有更改合并到我的副本中。如果我有开源项目所需的更改,我会提交补丁,但不会从我的副本中提交。
如果您是一个活跃的开发人员,而其他团队成员需要留在 VS2005 中,那么您可以并行加载 VS2005,不会出现问题。我在同一台机器上安装了 4-5 个 VS 副本 - 唯一的缺点是磁盘空间。
听起来如果您有太多冲突,您可能需要将项目重新检出到新文件夹中。然后你可以使用一个好的 diff 工具来手动解决冲突 - 我使用 WinMerge。
There are several options depending on how involved you are with the project and if you will be changing it.
For a project I am primarily using for the libraries I do not put the open-source projects into my solution - just the dll's which I keep in my source control repository in a libraries folder.
When you are debugging you can step into the code of the library in VS2008 without actually opening the 2005 project file; so no update is necessary.
When I do need to work on the code for the opensource library I open it in it's own solution. If it needs to update to vs2008 I let it - it is not a big deal as only the project files get changed - not the source code. Since it is in source control you can always revert the project files to the originals or rename your new copies and keep 2 csproj files side by side.
I only do a svn-update with tortoise on the open-source projects and do not get conflicts. Svn will merge any changes into my copy. If I have changes that are needed for the open-source project I submit a patch and do not commit from my copy.
If this is a project that you are an active developer and the other team members need to stay in VS2005 then you could load VS2005 side-by side without issue. I have had 4-5 copies of VS installed on the same machine - the only downside is disk space.
It sounds like you may need to do a fresh checkout of the project into a new folder if you have too many conflicts. Then you can use a good diff tool to resolve the conflicts manually - I use WinMerge.
Visual Studio 2008 将非常乐意打开只读解决方案(这是正常的、未签出的用法)。
但VS2008无法打开VS 2005解决方案文件,因此它总是尝试升级。您似乎正在寻找一种在 2008 年打开 2005 年解决方案而不升级的方法,我认为这是不可能的。
要么获取 VS 2005 的副本(这可能是 Express 版本),要么获取整个 Codeplex 项目进行升级(请记住 VS 2008 将针对 .NET 2.0)。
Visual Studio 2008 will quite happily open a read-only solution (this is the normal, non-checked-out usage).
But VS2008 can't open VS 2005 solution files, so it always tries to upgrade. You seem to be looking for a way to open a 2005 solution in 2008 without the upgrade, and I don't think this is possible.
Either get a copy of VS 2005 (this could be an Express edition), or get the Codeplex project as a whole to upgrade (remembering that VS 2008 will target .NET 2.0).