SharpDevelop Community

Get your problems solved!
Welcome to SharpDevelop Community Sign in | Join | Help
in Search

changing .NET assembly

Last post 07-05-2017 7:01 PM by sbridewell. 4 replies.
Page 1 of 1 (5 items)
Sort Posts: Previous Next
  • 07-01-2017 8:10 PM

    changing .NET assembly

    I am a newbie trying to learn Python and coming from a Visual Studio environment.

    I downloaded ver 4.4 (on windows 10). I have successfully created a winforms application. I'm struggling trying to get SQLite to work but during my trials and tribulations I tried to change the .Net framework that it is compiled with. I saw a YouTube video using an earlier version that showed right-clicking on the Project and going to properties and Comile tab. My version does not have all those options that the version 3.x shows in the video.

    Can anyone give me some help? Thanks very much in advance.

     

    Steve

     

     

  • 07-02-2017 5:14 PM In reply to

    Re: changing .NET assembly

    I've never worked with Python before but I just tried creating a python project using version 4.4, and there is indeed no option in the Compile tab of the project properties to change the framework version. Opening the project file in a text editor I noticed that there's no TargetFrameworkVersion property defined, whereas C# and VB project files normally contain this property.

    You could try adding a line to the .pyproj file similar to

        <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>

    within the first PropertyGroup element. When you save the file and switch back to SharpDevelop, it'll detect that the project has changed and prompt you to reload it, and hopefully it'll build using the .net version you've specified.

    Let us know how you get on.

    Simon

  • 07-02-2017 8:06 PM In reply to

    Re: changing .NET assembly

    Simon

    Thanks very much for the suggestion. I will try that and let you (in case you ever program in Python <G>).

    Steve

  • 07-04-2017 7:45 PM In reply to

    Re: changing .NET assembly

    Hi Simon

    Sorry it took so long to get back to you...

    I tried your suggestion and there was already three lines referencing a .NetFramework version (see below). I changed the three references to a version of a .Net version that was different from the one I specified on creating the new project. When I reloaded the project it reloaded without any prompts.

    I had expected the references in that file to be the same as the version I specified when creating the project. Surprisingly there weren't so maybe I was looking in the wrong place?

    Here is a snippet of that .pyproj file where I changed the version number:

    \IronPython.Modules.dll</HintPath>
        </Reference>
        <Reference Include="mscorlib" />
        <Reference Include="System" />
        <Reference Include="System.Core">
          <RequiredTargetFramework>4.0</RequiredTargetFramework>
        </Reference>
        <Reference Include="System.Data" />
        <Reference Include="System.Data.DataSetExtensions">
          <RequiredTargetFramework>4.0</RequiredTargetFramework>
        </Reference>
        <Reference Include="System.Drawing" />
        <Reference Include="System.Windows.Forms" />
        <Reference Include="System.Xml" />
        <Reference Include="System.Xml.Linq">
          <RequiredTargetFramework>4.5</RequiredTargetFramework>
        </Reference>

     

    And...when I looked at the version of the System.Data or System.Windows.Forms dll I noticed that those versions did not match the version of .Net which I selected when I created the new project. I had expected they would be the same. For example, when I chose 3.5 the dll version was 4.0---or am I confused?

    Thanks.

    Steve

     

     

  • 07-05-2017 7:01 PM In reply to

    Re: changing .NET assembly

    Those <Reference...> elements don't control the version of .net used to build your project, they are the assemblies that your project refers to (the "References" folder within your project in the solution explorer). For some reason (I don't know why), sometimes they have a <RequiredTargetFramework> child element specifying a different .net version to that used by the project, and I think this means that the project is specifying that the assembly in question should be taken from the specified version of .net rather than the same version that the project uses.

    It's the <TargetFrameworkVersion> element which controls the version of .net used to build your project (in C# projects anyway, but I don't think this would be different in other languages). This is how the beginning of one of my C# project files looks:

    <?xml version="1.0" encoding="utf-8"?>
    <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
      <PropertyGroup>
        <ProjectGuid>{85629A98-0B4A-489C-A201-64E514B5B516}</ProjectGuid>
        <ProjectTypeGuids>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
        <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
        <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
        <OutputType>Exe</OutputType>
        <RootNamespace>WindowsPortableDevice.ConsoleApp</RootNamespace>
        <AssemblyName>WindowsPortableDevice.ConsoleApp</AssemblyName>
        <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
        <AppDesignerFolder>Properties</AppDesignerFolder>
      </PropertyGroup>

    Simon

Page 1 of 1 (5 items)
Powered by Community Server (Commercial Edition), by Telligent Systems
Don't contact us via this (fleischfalle@alphasierrapapa.com) email address.