Why does a service pack that targets VS2008 and .NET 3.5 is cause a compilation error in a VS2005 bu

G

Guest

Hi,

After installing SP1 for VS2008 and SP1 for .NET 3.5 we get the following
warning in a VS2005 build:

error CS0618: Warning as Error: 'System.Windows.UIElement.BitmapEffect' is
obsolete: 'Avoid using BitmapEffects as they have very poor performance
characteristics. They will be deprecated in a future version. Consider
using the UIElement.Effect property and ShaderEffects where appropriate
instead.'

We do not get this error with VS2008 and .NET installed without SP1.

Why does a service pack that targets VS2008 and .NET 3.5 is cause a
compilation warning in a VS2005 build that targets .NET 3.0?
 
J

Jeroen Mostert

.. said:
After installing SP1 for VS2008 and SP1 for .NET 3.5 we get the following
warning in a VS2005 build:

error CS0618: Warning as Error: 'System.Windows.UIElement.BitmapEffect' is
obsolete: 'Avoid using BitmapEffects as they have very poor performance
characteristics. They will be deprecated in a future version. Consider
using the UIElement.Effect property and ShaderEffects where appropriate
instead.'

We do not get this error with VS2008 and .NET installed without SP1.

Why does a service pack that targets VS2008 and .NET 3.5 is cause a
compilation warning in a VS2005 build that targets .NET 3.0?
Because the .NET 2.0, 3.0 and 3.5 framework all share the 2.0 runtime and
the 2.0 framework library. The VS2008 service pack only targets VS, but .NET
3.5 SP1 (which has to be installed with it) upgrades the common 2.0 runtime
to 2.0 SP2. The ObsoleteAttribute is part of the class' metadata and will
affect compilers regardless of their version or target settings.

This shared base is how VS2008 can easily target different versions in the
first place (and also why you can actually write .NET 3.0 and 3.5
applications using VS2005, as long as you only use the new classes and not
the new language features).

As to the actual problem, you have two obvious solutions: either take the
deprecation warning to heart and rewrite your code (obviously the best
solution, but it may not be feasible) or exclude the warning for now. You
can selectively disable warnings at specific locations in your code by using
"#pragma warning" (excluding all obsolescence warnings globally is another
option, but is obviously risky if other classes are obsoleted after you do
this).
 
G

Guest

Thanks Jeroen - It seems that in this case the PresentationCore assembly was
modified.
 

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