Home All Groups Group Topic Archive Search About

Gracefully stopping a .NET 2 app on .NET 1.1 fcl system

Author
31 Mar 2006 12:41 PM
Mitch Gallant
*Without* using a deployment/setup project, is there a graceful way
of stopping a .NET 2 app. at start of execution on a .NET 1.1 fcl system?
(or is it best just ot let the CLR (or PE .. CLR invoker) inform you ?
- Mitch

Author
31 Mar 2006 2:21 PM
Nicole Calinoiu
The System.Environment.Version property will expose the fx version under
which your code is running.  If a "gateway" check is sufficient, you could
presumably verify that version in you application's entry method.

If you need to apply member- level verifications, a custom non-CAS
permission might come in handy.  However, the declarative form of such a
permission would be less useful since permission attributes were essentially
ignored in v. 1.x unless their assemblies were registered as policy
assemblies.

If you need pervasive protection against running under v. 1.x but want to
enable a custom user notification, your best bet might be to not support v.
1.x for any of your application assemblies, but instead use a
backward-compatible executable as a shim to detect the fx version and launch
the "real" executable if it's v. 2.0 or warn the user if it's not.



Show quoteHide quote
"Mitch Gallant" <jensigner@community.nospam> wrote in message
news:OGHBHCMVGHA.5660@TK2MSFTNGP12.phx.gbl...
> *Without* using a deployment/setup project, is there a graceful way
> of stopping a .NET 2 app. at start of execution on a .NET 1.1 fcl system?
> (or is it best just ot let the CLR (or PE .. CLR invoker) inform you ?
> - Mitch
>
>
Author
31 Mar 2006 2:59 PM
Dominick Baier [DevelopMentor]
depending on your definition of graceful - there are also these <requiredRuntime>
and <supportedRuntime> config settings...

---------------------------------------
Dominick Baier - DevelopMentor
http://www.leastprivilege.com

Show quoteHide quote
> The System.Environment.Version property will expose the fx version
> under which your code is running.  If a "gateway" check is sufficient,
> you could presumably verify that version in you application's entry
> method.
>
> If you need to apply member- level verifications, a custom non-CAS
> permission might come in handy.  However, the declarative form of such
> a permission would be less useful since permission attributes were
> essentially ignored in v. 1.x unless their assemblies were registered
> as policy assemblies.
>
> If you need pervasive protection against running under v. 1.x but want
> to enable a custom user notification, your best bet might be to not
> support v. 1.x for any of your application assemblies, but instead use
> a backward-compatible executable as a shim to detect the fx version
> and launch the "real" executable if it's v. 2.0 or warn the user if
> it's not.
>
> "Mitch Gallant" <jensigner@community.nospam> wrote in message
> news:OGHBHCMVGHA.5660@TK2MSFTNGP12.phx.gbl...
>
>> *Without* using a deployment/setup project, is there a graceful way
>> of stopping a .NET 2 app. at start of execution on a .NET 1.1 fcl
>> system?
>> (or is it best just ot let the CLR (or PE .. CLR invoker) inform you
>> ?
>> - Mitch
Author
31 Mar 2006 5:48 PM
Nicole Calinoiu
Those only work to allow running on earlier framework versions, not to
prevent it.  Of course, lack of support for other versions is implicit in
the absence of the settings, but that's trivially overridden by addition of
an "unsupported" config file...


Show quoteHide quote
"Dominick Baier [DevelopMentor]" <dbaier@pleasepleasenospamdevelop.com>
wrote in message news:4580be631991fb8c822fba62aef9e@news.microsoft.com...
> depending on your definition of graceful - there are also these
> <requiredRuntime> and <supportedRuntime> config settings...
>
> ---------------------------------------
> Dominick Baier - DevelopMentor
> http://www.leastprivilege.com
>
>> The System.Environment.Version property will expose the fx version
>> under which your code is running.  If a "gateway" check is sufficient,
>> you could presumably verify that version in you application's entry
>> method.
>>
>> If you need to apply member- level verifications, a custom non-CAS
>> permission might come in handy.  However, the declarative form of such
>> a permission would be less useful since permission attributes were
>> essentially ignored in v. 1.x unless their assemblies were registered
>> as policy assemblies.
>>
>> If you need pervasive protection against running under v. 1.x but want
>> to enable a custom user notification, your best bet might be to not
>> support v. 1.x for any of your application assemblies, but instead use
>> a backward-compatible executable as a shim to detect the fx version
>> and launch the "real" executable if it's v. 2.0 or warn the user if
>> it's not.
>>
>> "Mitch Gallant" <jensigner@community.nospam> wrote in message
>> news:OGHBHCMVGHA.5660@TK2MSFTNGP12.phx.gbl...
>>
>>> *Without* using a deployment/setup project, is there a graceful way
>>> of stopping a .NET 2 app. at start of execution on a .NET 1.1 fcl
>>> system?
>>> (or is it best just ot let the CLR (or PE .. CLR invoker) inform you
>>> ?
>>> - Mitch
>
>
Author
31 Mar 2006 3:28 PM
Mitch Gallant
So the first method should work. I wanted to know if there was
any pre-jit which detected compiled version of assembly versus
installed version and would stop cold if compiled to fcl 2 but only
1.1 installed .. or if the JIT would execute and then crash on an
unknown api call?

The final solution is along the lines I was considering.

Thnx,
- Mitch

Show quoteHide quote
"Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message news:uiKn$5MVGHA.4452@TK2MSFTNGP12.phx.gbl...
> The System.Environment.Version property will expose the fx version under which your code is running.  If a "gateway"
> check is sufficient, you could presumably verify that version in you application's entry method.
>
> If you need to apply member- level verifications, a custom non-CAS permission might come in handy.  However, the
> declarative form of such a permission would be less useful since permission attributes were essentially ignored in v.
> 1.x unless their assemblies were registered as policy assemblies.
>
> If you need pervasive protection against running under v. 1.x but want to enable a custom user notification, your best
> bet might be to not support v. 1.x for any of your application assemblies, but instead use a backward-compatible
> executable as a shim to detect the fx version and launch the "real" executable if it's v. 2.0 or warn the user if it's
> not.
>
>
>
> "Mitch Gallant" <jensigner@community.nospam> wrote in message news:OGHBHCMVGHA.5660@TK2MSFTNGP12.phx.gbl...
>> *Without* using a deployment/setup project, is there a graceful way
>> of stopping a .NET 2 app. at start of execution on a .NET 1.1 fcl system?
>> (or is it best just ot let the CLR (or PE .. CLR invoker) inform you ?
>> - Mitch
>>
>>
>
Author
31 Mar 2006 6:01 PM
Nicole Calinoiu
If you attempt to execute an application compiled under 2.0 under an earlier
version that it does not support (as specified by the requiredRuntime and/or
supportedRuntime configuration settings that Dominick mentioned), the
following message box will be displayed:

---------------------------
..NET Framework Initialization Error
---------------------------
To run this application, you first must install one of the following
versions of the .Net Framework:

  v2.0.50727

Contact your application publisher for instructions about obtaining the
appropriate version of the .Net Framework.
---------------------------
OK
---------------------------

If your application config file indicates that it supports an earlier
version, but the application actually uses unsupported functionality,
JIT-time errors will occur.



Show quoteHide quote
"Mitch Gallant" <jensigner@community.nospam> wrote in message
news:%23v$lDfNVGHA.4740@TK2MSFTNGP14.phx.gbl...
> So the first method should work. I wanted to know if there was
> any pre-jit which detected compiled version of assembly versus
> installed version and would stop cold if compiled to fcl 2 but only
> 1.1 installed .. or if the JIT would execute and then crash on an
> unknown api call?
>
> The final solution is along the lines I was considering.
>
> Thnx,
> - Mitch
>
> "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com> wrote in message
> news:uiKn$5MVGHA.4452@TK2MSFTNGP12.phx.gbl...
>> The System.Environment.Version property will expose the fx version under
>> which your code is running.  If a "gateway" check is sufficient, you
>> could presumably verify that version in you application's entry method.
>>
>> If you need to apply member- level verifications, a custom non-CAS
>> permission might come in handy.  However, the declarative form of such a
>> permission would be less useful since permission attributes were
>> essentially ignored in v. 1.x unless their assemblies were registered as
>> policy assemblies.
>>
>> If you need pervasive protection against running under v. 1.x but want to
>> enable a custom user notification, your best bet might be to not support
>> v. 1.x for any of your application assemblies, but instead use a
>> backward-compatible executable as a shim to detect the fx version and
>> launch the "real" executable if it's v. 2.0 or warn the user if it's not.
>>
>>
>>
>> "Mitch Gallant" <jensigner@community.nospam> wrote in message
>> news:OGHBHCMVGHA.5660@TK2MSFTNGP12.phx.gbl...
>>> *Without* using a deployment/setup project, is there a graceful way
>>> of stopping a .NET 2 app. at start of execution on a .NET 1.1 fcl
>>> system?
>>> (or is it best just ot let the CLR (or PE .. CLR invoker) inform you ?
>>> - Mitch
>>>
>>>
>>
>
>