CAS 不适用于 VS2010 映射驱动器

发布于 2024-11-30 21:11:35 字数 1777 浏览 2 评论 0 原文

我有一个使用亚音速的项目,该项目是我在 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.

enter image description here

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.

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

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

发布评论

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

评论(2

烙印 2024-12-07 21:11:35

为了方便后代,这里是我的一些调查结果。

VS 2010 中的映射驱动器:

  • 有一条关于从不安全加载项目的初始消息
    地点。如所述,使用 CASPOL 可以解决此问题。卡斯波尔很漂亮
    其 URL 非常灵活,并且接受两种显示的格式。 CASPOL 是
    默认情况下在 .NET 4 中禁用,因此设置不会产生影响(请参阅原因 在这里)。
  • 之后还有几个问题,我没有记录它们,但修复每个问题后,又出现了另一个问题。 loadFromRemoteSources 修复了一条消息,但我所做的任何事情都无法触及“无法开始监视更改...”。作为其中的一部分,Christoph 的答案可能是正确的(至少对于 .NET 2 而言),因为您可能必须在驱动器上设置每个程序集,这对于 VS 项目驱动器来说是完全不切实际的。

因此,毫不奇怪,我认为将 VS 项目存储在映射驱动器上会非常痛苦。源代码控制和本地项目是最佳选择。坦率地说,在我看来,网络驱动器上缺乏撤消功能对于开发工作来说也是一种痛苦。

最初的问题并不是我需要一个联网驱动器,而是我不想将项目存储在虚拟机的 C: 上(即,我希望能够与基于虚拟机的驱动器分开备份数据)图像)。

答案一直在我面前,就是创建第二个虚拟磁盘并将其作为 G: 连接到虚拟机。它是本地驱动器,因此我不会遇到所有信任问题,但我得到了完整的数据分离。我将该驱动器上的所有数据保存在 Dropbox 文件夹中,同时也为我提供了完整的实时异地备份,这让我很高兴。

For posterity, here are some results of my investigations.

Mapped drives in VS 2010:

  • there is an initial message about loading a project from an unsafe
    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).
  • after that there are several more problems, I didn't document them but after fixing each one, another springs up. loadFromRemoteSources fixed one message, but nothing I did could touch 'Failed to start monitoring changes ...'. As part of this, Christoph's answer is probably correct (at least for .NET 2) in that you'd probably have to set up each assembly on the drive, which is totally impractical for a VS project drive.

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.

小镇女孩 2024-12-07 21:11:35

也许我错了(我没有查过),但我认为在处理映射驱动器时需要使用强名称。就像

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.

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