我有一个使用亚音速的项目,该项目是我在 Visual Studio 2008 中开发的,位于 C: 驱动器上。那里没问题。
我刚刚升级到 Visual Studio 2010(由于我的计算机碰巧死机了,我现在运行的是使用 VirtualBox 虚拟化的 Windows XP)。
该项目在 C: 驱动器上运行,没有任何投诉,但如果我从 G:(指向基本 PC 上的分区的映射驱动器)运行它,我无法运行 subsonic 使用的自定义工具(下面列出的错误),或者运行Web应用程序(“启动而不调试”给我:无法开始监视“G:\GPNNT\GpnntApp\GpnntApp”的更改)。
这是一个 .net 3.5 解决方案。
这似乎是一个有据可查且简单的问题。
我已采取以下操作:
(1)批处理文件
c:
cd "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
caspol -all -reset
caspol -q -machine -addgroup 1 -url file:////g:\* FullTrust -name "G Drive"
caspol -q -machine -addgroup 1 -url g:\* FullTrust -name "G Drive 1"
c:
cd "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"
caspol -all -reset
caspol -q -machine -addgroup 1 -url file:////g:\* FullTrust -name "G Drive"
caspol -q -machine -addgroup 1 -url g:\* FullTrust -name "G Drive"
pause
(我尝试了无数种不同的网址格式,但均无济于事)
(2).Net 2.0配置实用程序(控制面板>管理工具)
使用分析工具,两者在上面的批处理文件中进行的设置似乎适用于驱动器上的文件。
我还尝试将 Intranet 组设置为 FullTrust(我不想这样做!)。没有区别。
(3) loadFromRemoteSources
可以合理地假设,虽然项目本身只使用.NET 2,但VS2010本身可能在内部使用.NET 4。经过更多谷歌搜索后(例如
<前><代码><运行时>;
到两个 .net 版本的 machine.config 文件。
(4) 升级到VS2010 SP1
这些都没有产生任何影响。
在我的血压达到危险的高水平之前,有人能解释一下吗?我想我可以回到在 C: 上运行所有内容,但在这个虚拟化时代,这似乎有点荒谬。我真的希望数据位于与虚拟机不同的位置。
我注意到这篇 SO帖子也有同样的问题,并指责测试项目,这不是非常令人满意。我也没有测试项目,尽管我想 SubSonic dll 中可能埋藏着测试引用。
最后一刻补充:我还注意到 SQL Server 2005/8 不会与 G: 对话(例如,从那里恢复备份),并假设任何解决方案也将允许这种情况发生。这将是另一个值得拥有的东西。
I have a project using subsonic that I developed in Visual Studio 2008 on C: drive. No problem there.
I've just upgraded to Visual Studio 2010 (and as my computer coincidentally died, I'm now running Windows XP virtualised with VirtualBox).
The project runs without complaint on C: drive, but if I run it from G: (a mapped drive which points to a partition on the base PC), I can't run the custom tools subsonic uses (error listed below), OR run the web application ('start without debugging' gives me: Failed to start monitoring changes to 'G:\GPNNT\GpnntApp\GpnntApp').
This is a .net 3.5 solution.
This would seem to be a well-documented and straightforward problem.
I have taken the following actions:
(1) BATCH FILE
c:
cd "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
caspol -all -reset
caspol -q -machine -addgroup 1 -url file:////g:\* FullTrust -name "G Drive"
caspol -q -machine -addgroup 1 -url g:\* FullTrust -name "G Drive 1"
c:
cd "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319"
caspol -all -reset
caspol -q -machine -addgroup 1 -url file:////g:\* FullTrust -name "G Drive"
caspol -q -machine -addgroup 1 -url g:\* FullTrust -name "G Drive"
pause
(I have tried a zillion different url formats, all to no avail)
(2) The .Net 2.0 Configuration utility (Control Panel > Admin Tools)
Using the analysis tool, both settings made in the batch file above appear to apply to files on the drive.
I also tried setting the intranet group to FullTrust (something I'd rather not do !). No difference.
(3) loadFromRemoteSources
It is reasonable to assume that although the project itself only uses .NET 2, VS2010 itself might use .NET 4 internally. After some more googling (eg here), I added
<runtime>
<loadFromRemoteSources enabled="true"/>
</runtime>
to both .net versions' machine.config files.
(4) Upgrading to VS2010 SP1
None of these has made an iota of difference.
Can anyone shed light on this before my blood pressure reaches dangerously high levels ? I suppose I can go back to running everything off C:, but it does seem a bit ridiculous in this age of virtualisation. I really want the data in a different place to the VM.
I note this SO post has the same problem, and blames Test projects, which is not terribly satisfactory. I also don't have a test project, although there may be test references buried in the SubSonic dlls somewhere I suppose.
LAST MINUTE ADDITION: I also notice SQL Server 2005/8 won't talk to G: (eg. recover a backup from there), and assume any solution would also allow this to occur. That would be another great-to-have.
发布评论
评论(2)
为了方便后代,这里是我的一些调查结果。
VS 2010 中的映射驱动器:
地点。如所述,使用 CASPOL 可以解决此问题。卡斯波尔很漂亮
其 URL 非常灵活,并且接受两种显示的格式。 CASPOL 是
默认情况下在 .NET 4 中禁用,因此设置不会产生影响(请参阅原因 在这里)。
因此,毫不奇怪,我认为将 VS 项目存储在映射驱动器上会非常痛苦。源代码控制和本地项目是最佳选择。坦率地说,在我看来,网络驱动器上缺乏撤消功能对于开发工作来说也是一种痛苦。
但
最初的问题并不是我需要一个联网驱动器,而是我不想将项目存储在虚拟机的 C: 上(即,我希望能够与基于虚拟机的驱动器分开备份数据)图像)。
答案一直在我面前,就是创建第二个虚拟磁盘并将其作为 G: 连接到虚拟机。它是本地驱动器,因此我不会遇到所有信任问题,但我得到了完整的数据分离。我将该驱动器上的所有数据保存在 Dropbox 文件夹中,同时也为我提供了完整的实时异地备份,这让我很高兴。
For posterity, here are some results of my investigations.
Mapped drives in VS 2010:
location. This is fixed using CASPOL as described. CASPOL is pretty
flexible with its URLs and accepts both the shown formats. CASPOL is
disabled in .NET 4 by default so the settings won't make a difference (see reasons here).
So, not surprisingly, I think it is just going to be too painful to store VS projects on a mapped drive. Source control and a local project are the way to go. Frankly, the lack of undo on a networked drive is a pain for dev work as well IMO.
BUT
the original issue was not so much that I needed a networked drive as that I didn't want to store the project on C: of my VM (ie. I wanted to be able to back up the data separately from the VM based drive image).
The answer staring me in the face the whole time, was to create a second virtual disk and attach it to the VM as G:. It's a local drive, so I don't get all the trust issues, but I get full data separation. I keep all the data on that drive in a Dropbox folder, giving me full realtime offsite backup as well, and that's me happy.
也许我错了(我没有查过),但我认为在处理映射驱动器时需要使用强名称。就像
caspol -m -q -ag My_Machine_Zone -url g:\* Nothing -n "GDrive"
caspol -m -q -ag "GDrive" -strong -file "; ” “<程序集强名称>” “<程序集版本>” FullTrust -n "GDriveFileX" -d "Code Group for fileX"
我总是会创建一个顶级组,以便您稍后可以轻松修改或删除该策略。我认为不允许完全信任基于 uri 的映射驱动器是有道理的,尽管这很痛苦。
如果可能的话,使用更现代的东西。
Maybe I'm wrong (I did not look this up) but I think you need to work with strong names when working on mapped drives. Like
caspol -m -q -ag My_Machine_Zone -url g:\* Nothing -n "GDrive"
caspol -m -q -ag "GDrive" -strong -file "<pathToFile>" "<assemblyStrongName>" "<assemblyVersion>" FullTrust -n "GDriveFileX" -d "Code Group for fileX"
I would always create a toplevel group so you can easily modify or remove the policy later on. I think it makes sense not to allow to give full trust to a mapped drive based on the uri e ven though this is painfull.
If possible use something more modern.