问题
(updated this after various other attempts to crack it!)
I have a VM (Win7 32 bit) with VS2010 installed. I have a drive mapped (not a vm shared folder 'cos I found a write-latency issue in other scenarios) into it from the host machine (VM 64 bit), when I have some of my VS2010 projects and to where I am building them. (I've also tried mapped from an XP 32 bit host as well, but have exactly the same problem).
One of my projects is looking to load an assembly. If I copy that assembly to a local drive, the program ruins fine. If I leave it on the mapped drive, then I get an error
Exception is: FileLoadException - Could not load file or assembly 'file:///G:\BusinessTier\bin\Debug\BusinessTier.dll
I am unsure whether or not I need to run Caspol. There is another post on SO which pointed me to a post which indicated that VS2008 SP1+ removed the need for caspol wrt network drives, but I wondered if I still needed to because I am in a VM.
I have tried running the following on the host machine in an attempt to give permissions to VS inside the VM, but to no avail
C:\Windows\Microsoft.NET\Framework\v4.0.30128>caspol -m -ag 1 -url file://g:\* FullTrust
C:\Windows\Microsoft.NET\Framework\v4.0.30128>caspol -m -ag 1.2 -url file://g:\* FullTrust
C:\Windows\Microsoft.NET\Framework\v4.0.30128>caspol -m -ag 1.3 -url file://g:\* FullTrust
C:\Windows\Microsoft.NET\Framework\v4.0.30128>caspol -m -ag 1.5 -url file://g:\* FullTrust
where g:* is the drive being mapped into the VM (as drive z:)
Similarly, following various blog postings (A), I have tried
- replacing the local drive letter to a unc
- quoting file://unc and/or drive letter e.g. "file://g:*"
- adding various numbers of forward/back slashes e.g. file://g:/* with unc and local path
However (and this could be a red herring), if I create a simple winforms exe in the VM and save it onto the g: drive it seems to run okay
What am I missing (apart from understanding!)?
I am beginning to wonder whether the problem is a permissions issue on the host vm, but I have given Full control permissions to Everyone on that share. (Although I can read and write to that folder so TMM the permissions look like they are probably correct). Should that be good enough for a user who is connecting remotely?
Thx
Simon
A - There are a whole host of other blog entries which offer alternative solutions, none of which appear to work for me. but others have had success with e.g. (perhaps this may help others)
- https://julianscorner.com/wiki/programming/caspol_network_share
- http://www.cmagic.biz/wordpress/2006/02/27/caspol-is-your-friend-do-you-trust-me/
- http://communities.vmware.com/message/1083305
- http://blogs.imeta.co.uk/sstrong/archive/2009/01/29/589.aspx
回答1:
try to execute caspol using the hostname instead of the network drive, e.g.
caspol -m -ag 1.3 -url "file://\.vmware-host/*" FullTrust
来源:https://stackoverflow.com/questions/2801968/caspol-vms-mapped-drives-vs2010