Framework 4 Client Profile

Sep 20, 2011 at 3:08 PM

I find that the full Framework 4 installation is required to use the DotSpatial libraries. Can someone tell me if it would be possible for DotSpatial to be released with only .Net Framework 4 Client Profile?

I read in http://dotspatial.codeplex.com/discussions/223583 that suggests that the full version allows inclusion of System.Design which facilitates backwards compatibility with Framework 3.5. However, because 3.5 if no longer being supported, this library may no longer be needed. My clients (enterprise environment) only have Client Profile installed.

Thanks for your quick response.

Chris

Sep 20, 2011 at 4:40 PM

I have downloaded the latest source code to investigate dependencies on assemblies not included in Framework 4 Client Profile. I reset each project's target Framework to Client Profile and recompiled and find the following error messages (I deleted all the cascading errors and warnings and cleaned it up to make it easier to read):

------ Rebuild All started: Project: DotSpatial.Serialization, Configuration: Debug Any CPU ------
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3267: The primary reference "System.Web.Extensions", which is a framework assembly, could not be resolved in the currently targeted framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this problem, either remove the reference "System.Web.Extensions" or retarget your application to a framework version which contains "System.Web.Extensions".
------ Rebuild All started: Project: DotSpatial.Projections.Forms, Configuration: Debug Any CPU ------
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3252: Could not resolve assembly "System.Design". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3252: Could not resolve assembly "System.Drawing.Design". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
------ Rebuild All started: Project: DotSpatial.Symbology.Forms, Configuration: Debug Any CPU ------
C:\Projects\DotSpatial Source\DotSpatial.Symbology\DotSpatial.Symbology.Forms\PointCategoryCollectionEditor.cs(29,50): error CS0246: The type or namespace name 'CollectionEditor' could not be found (are you missing a using directive or an assembly reference?)
C:\Projects\DotSpatial Source\DotSpatial.Symbology\DotSpatial.Symbology.Forms\BitmapFileNameEditor.cs(30,41): error CS0246: The type or namespace name 'FileNameEditor' could not be found (are you missing a using directive or an assembly reference?)
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3252: Could not resolve assembly "System.Design". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
------ Rebuild All started: Project: DotSpatial.Controls, Configuration: Debug Any CPU ------
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3252: Could not resolve assembly "System.Design". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.
c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3252: Could not resolve assembly "System.Web". The assembly is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

As you can see, four assemblies contain references to the full framework: .Serialization, .Projections.Forms, .Symbology.Forms, and .Controls. I am not familiar enough with the code to understand the implications of these references, however I've read online of discussions with Microsoft and the advice given was to always separate Designer libraries from runtime libraries. Thus, parts of the .Forms or .Controls libraries that required the full Framework 4 would not be included in the distribution to end users. Thus, I could target my application to Client Profile.

Why does this matter? I'm developing an open source application that will be used by enterprise customers who only have Client Profile installed and who do not have Administrator privileges to upgrade their framework version (that's why I reprogrammed from MW4.x to DS--to avoid admin installs of the OCX!).

I will see if I can disable the parts of the DS application that cause the above errors, but regardless, I think it is important to separate out those parts of the code that need more than Client Profile.

Thanks,

Chris

Developer
Sep 20, 2011 at 6:27 PM
Can you cut a fork, and see if it can be done?

You might be able to use #if directives
http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx

Then would could setup a build for that profile

On Tue, Sep 20, 2011 at 9:40 AM, lloydchriswilson
<notifications@codeplex.com> wrote:
> From: lloydchriswilson
>
> I have downloaded the latest source code to investigate dependencies on
> assemblies not included in Framework 4 Client Profile. I reset each
> project's target Framework to Client Profile and recompiled and find the
> following error messages (I deleted all the cascading errors and warnings
> and cleaned it up to make it easier to read):
>
> ------ Rebuild All started: Project: DotSpatial.Serialization,
> Configuration: Debug Any CPU ------
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
> warning MSB3267: The primary reference "System.Web.Extensions", which is a
> framework assembly, could not be resolved in the currently targeted
> framework. ".NETFramework,Version=v4.0,Profile=Client". To resolve this
> problem, either remove the reference "System.Web.Extensions" or retarget
> your application to a framework version which contains
> "System.Web.Extensions".
> ------ Rebuild All started: Project: DotSpatial.Projections.Forms,
> Configuration: Debug Any CPU ------
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
> warning MSB3252: Could not resolve assembly "System.Design". The assembly is
> not in the currently targeted framework
> ".NETFramework,Version=v4.0,Profile=Client". Please remove references to
> assemblies not in the targeted framework or consider retargeting your
> project.
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
> warning MSB3252: Could not resolve assembly "System.Drawing.Design". The
> assembly is not in the currently targeted framework
> ".NETFramework,Version=v4.0,Profile=Client". Please remove references to
> assemblies not in the targeted framework or consider retargeting your
> project.
> ------ Rebuild All started: Project: DotSpatial.Symbology.Forms,
> Configuration: Debug Any CPU ------
> C:\Projects\DotSpatial
> Source\DotSpatial.Symbology\DotSpatial.Symbology.Forms\PointCategoryCollectionEditor.cs(29,50):
> error CS0246: The type or namespace name 'CollectionEditor' could not be
> found (are you missing a using directive or an assembly reference?)
> C:\Projects\DotSpatial
> Source\DotSpatial.Symbology\DotSpatial.Symbology.Forms\BitmapFileNameEditor.cs(30,41):
> error CS0246: The type or namespace name 'FileNameEditor' could not be found
> (are you missing a using directive or an assembly reference?)
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
> warning MSB3252: Could not resolve assembly "System.Design". The assembly is
> not in the currently targeted framework
> ".NETFramework,Version=v4.0,Profile=Client". Please remove references to
> assemblies not in the targeted framework or consider retargeting your
> project.
> ------ Rebuild All started: Project: DotSpatial.Controls, Configuration:
> Debug Any CPU ------
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
> warning MSB3252: Could not resolve assembly "System.Design". The assembly is
> not in the currently targeted framework
> ".NETFramework,Version=v4.0,Profile=Client". Please remove references to
> assemblies not in the targeted framework or consider retargeting your
> project.
> c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9):
> warning MSB3252: Could not resolve assembly "System.Web". The assembly is
> not in the currently targeted framework
> ".NETFramework,Version=v4.0,Profile=Client". Please remove references to
> assemblies not in the targeted framework or consider retargeting your
> project.
>
> As you can see, four assemblies contain references to the full framework:
> .Serialization, .Projections.Forms, .Symbology.Forms, and .Controls. I am
> not familiar enough with the code to understand the implications of these
> references, however I've read online of discussions with Microsoft and the
> advice given was to always separate Designer libraries from runtime
> libraries. Thus, parts of the .Forms or .Controls libraries that required
> the full Framework 4 would not be included in the distribution to end users.
> Thus, I could target my application to Client Profile.
>
> Why does this matter? I'm developing an open source application that will be
> used by enterprise customers who only have Client Profile installed and who
> do not have Administrator privileges to upgrade their framework version
> (that's why I reprogrammed from MW4.x to DS--to avoid admin installs of the
> OCX!).
>
> I will see if I can disable the parts of the DS application that cause the
> above errors, but regardless, I think it is important to separate out those
> parts of the code that need more than Client Profile.
>
> Thanks,
>
> Chris
>
> Read the full discussion online.
>
> To add a post to this discussion, reply to this email
> ([email removed])
>
> To start a new discussion for this project, email
> [email removed]
>
> You are receiving this email because you subscribed to this discussion on
> CodePlex. You can unsubscribe or change your settings on codePlex.com.
>
> Please note: Images and attachments will be removed from emails. Any posts
> to this discussion will also be available online at codeplex.com
Sep 20, 2011 at 7:44 PM

It looks to be a pretty big job. I found the following link that explains why and how to separate the design-time and runtime components into different projects:

http://archive.msdn.microsoft.com/WinFormsCustomCtrl

I originally thought that the issue was primarily related to design-time support for, say, the Ribbon control (where you can click on a glyph and get some help setting properties during design).

After doing some more investigating, I've found that some pretty mundane features that were included in Framework 2.0 are not in the Client Profile.

For example, in Symbology.Forms (as well as in my application), the property grid uses the System.Windows.Forms.Design.FileNameEditor so a file can be picked using the property grid. 

Consequently, even if my original request could be fulfilled for the DotSpatial controls, I'd still have a problem with my application not running in the Client Profile without some modification.

It appears that MS thought that the property grid UI classes were only being used for design-time support, however "advanced" tools like DS and my WRDB actually utilize the property grid extensively.

It would still be a good thing if both applications supported the Client Profile, if I start trying to make fundamental changes to the organization of the DS libraries, I don't think I'll make it out alive.

 

Chris

Developer
Sep 20, 2011 at 8:44 PM

I would vote for supporting the client profile and moving move advanced features into extensions.

Coordinator
Sep 20, 2011 at 8:51 PM

This is a really good idea.

- Dan
--------
Daniel P. Ames Ph.D.
Idaho State University Dept. of Geosciences
dan.ames@isu.edu
--------
Sent from my Droid

On Sep 20, 2011 2:44 PM, "mudnug" <notifications@codeplex.com> wrote:
> From: mudnug
>
> I would vote for supporting the client profile and moving move advanced features into extensions.
>
>
Feb 2, 2012 at 3:46 PM

It looks like you successfully refactored the code to use Framework 4 Client Profile. Thanks very much!

In my note of September 20, I mentioned that the unavailability of certain type classes was a killer (e.g., FileNameEditor). I was determined to make my application only require Client profile, so I substituted my own type editor for the full one. I usually have to inherit them anyway, and it is an easy change with similar functionality:

    Private Class clsGraphicFileEditor : Inherits System.Drawing.Design.UITypeEditor

        Public Overrides Function GetEditStyle(context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
            Return Drawing.Design.UITypeEditorEditStyle.Modal
        End Function

        Public Overrides Function EditValue(context As System.ComponentModel.ITypeDescriptorContext, provider As System.IServiceProvider, value As Object) As Object
            With New OpenFileDialog
                .AddExtension = True
                .CheckFileExists = True
                .DefaultExt = "bmp"
                .Filter = "All Image Files (*.bmp,*.gif,*.jpg,*.jpeg,*.png,*.ico,*.emf,*.wmf)|*.bmp;*.gif;*.jpg;*.jpeg;*.png;*.ico;*.emf;*.wmf"
                If String.IsNullOrEmpty(Project.DesktopGraphicFile) Then
                    .InitialDirectory = AppDataPath
                Else
                    .InitialDirectory = IO.Path.GetDirectoryName(Project.DesktopGraphicFile)
                End If
                .FileName = Project.DesktopGraphicFile
                If .ShowDialog() = Windows.Forms.DialogResult.OK Then
                    Return .FileName
                Else
                    Return "" 'if cancel, will clear
                End If
            End With
        End Function
    End Class

...and...

    Private Class clsGISFolderEditor : Inherits System.Drawing.Design.UITypeEditor
        Public Overrides Function GetEditStyle(context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
            Return Drawing.Design.UITypeEditorEditStyle.Modal
        End Function

        Public Overrides Function EditValue(context As System.ComponentModel.ITypeDescriptorContext, provider As System.IServiceProvider, value As Object) As Object
            With New FolderBrowserDialog
                .Description = "Select folder where GIS shape files will be saved for this project."
                .SelectedPath = Project.GisDirectory
                If .SelectedPath = "" Then .SelectedPath = My.Computer.FileSystem.SpecialDirectories.MyDocuments & "\WRDB"
                If .ShowDialog = Windows.Forms.DialogResult.OK Then
                    Return .SelectedPath
                Else
                    Return ""
                End If
            End With
        End Function
    End Class

I thought I'd share in case anyone else used the Properties Grid and wants to avoid using those expensive classes.

Chris