compiling with only /clr generates error when run from command lin

G

Guest

What do I have to set to get a VS.NET 2005 executable generated with the /clr
(without :safe) option to run from the command line.

using namespace System;

void main()
{
Console::WriteLine("Hi");
}

Compiled on the command line with:
cl /clr Test.cpp

I always get:

Unhandled Exception: System.IO.FileLoadException: Failed to grant required
minim
um permissions to assembly 'Test, Version=0.0.0.0, Culture=neutral, PublicKey
Token=null'.
File name: 'Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' --->
System.Security.Policy.PolicyException: Required permissions can not be
acquire
d.
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
Permissio
nSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet&
den
ied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence,
Permissio
nSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet&
den
ied, Int32& grantedIsUnrestricted, Boolean checkExecutionPermission)
 
J

Jochen Kalmbach

=?Utf-8?B?U3RlcGhlbiBSLiBHLiBGcmFzZXI=?= said:
What do I have to set to get a VS.NET 2005 executable generated with
the /clr
(without :safe) option to run from the command line.

Is your code executed from a local drive?
I guess not!


--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
G

Guest

Hmmm interesting.

I'm running it from my C: drive but I am using a mapping to it. Subst does
work though.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top