How to build against .net framework 3.5 in the vs2019 image?

Davyd McColl's Avatar

Davyd McColl

27 Apr, 2020 08:19 PM

Hi

I'm trying to build log4net which targets many .net variants:
- net20
- net35
- net35-client
- net40
- net40-client
- net45
- netstandard1.3
- netstandard2.0

The vs 2019 build environment would be a 100% fit if it just had .net framework 3.5 installed -- is there a way to make this happen?

  1. Support Staff 1 Posted by Feodor Fitsner on 27 Apr, 2020 08:24 PM

    Feodor Fitsner's Avatar

    Hi Davyd,

    .NET Framework 3.5 is installed on VS 2019 image. How do you build the app? What error do you get?

  2. 2 Posted by Davyd McColl on 27 Apr, 2020 08:35 PM

    Davyd McColl's Avatar

    Hi

    Thanks for getting back to me

    The issue seems to be particular to the -client targets: here's the output
    from build (which does work on another machine with all targets; the build
    system is a bunch of node stuff that I've written and maintained for years)

    [20:12:37] Building with full .NET framework
    [20:12:37] Any error fails the build : true
    [20:12:37] Build architecture : x64
    [20:12:37] Build configuration : Debug
    [20:12:37] Build platform : Any CPU
    [20:12:37] Build targets : Clean,Build
    [20:12:37] Build verbosity : minimal
    [20:12:37] Log to stdout : true
    [20:12:37] Max CPUs to use for build : 1
    [20:12:37] Re-use MSBUILD nodes : false
    [20:12:37] Tools version : auto
    [20:12:40] Using MSBuild command: C:\Program Files (x86)\Microsoft Visual
    Studio\2019\Community\MSBuild\Current\Bin\amd64\MSBuild.exe
    C:\projects\logging-log4net\src\log4net.sln /target:Clean;Build
    /verbosity:minimal /toolsversion:Current /maxcpucount:1 /nodeReuse:False
    /property:Platform=Any CPU /property:Configuration=Debug
    Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.
    log4net -> C:\projects\logging-log4net\build\Debug\net20\log4net.dll
    log4net -> C:\projects\logging-log4net\build\Debug\net35\log4net.dll
    C:\Program Files (x86)\Microsoft Visual
    Studio\2019\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1177,5):
    error MSB3644: The reference assemblies for
    .NETFramework,Version=v3.5,Profile=Client were not found. To resolve this,
    install the Developer Pack (SDK/Targeting Pack) for this framework version
    or retarget your application. You can download .NET Framework Developer
    Packs at https://aka.ms/msbuild/developerpacks
    [C:\projects\logging-log4net\src\log4net\log4net.csproj]
    log4net -> C:\projects\logging-log4net\build\Debug\net40\log4net.dll
    C:\Program Files (x86)\Microsoft Visual
    Studio\2019\Community\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(1177,5):
    error MSB3644: The reference assemblies for
    .NETFramework,Version=v3.5,Profile=Client were not found. To resolve this,
    install the Developer Pack (SDK/Targeting Pack) for this framework version
    or retarget your application. You can download .NET Framework Developer
    Packs at https://aka.ms/msbuild/developerpacks
    [C:\projects\logging-log4net\src\log4net\log4net.csproj]
    log4net -> C:\projects\logging-log4net\build\Debug\net45\log4net.dll
    log4net ->
    C:\projects\logging-log4net\build\Debug\netstandard1.3\log4net.dll
    log4net ->
    C:\projects\logging-log4net\build\Debug\netstandard2.0\log4net.dll
    log4net.Tests ->
    C:\projects\logging-log4net\src\log4net.Tests\bin\Debug\net462\log4net.Tests.dll
    [20:12:54] MSBuild failed with code 1!
    [20:12:54] 'build' errored after 18 s

    Thanks
    -d

  3. Support Staff 3 Posted by Feodor Fitsner on 27 Apr, 2020 08:57 PM

    Feodor Fitsner's Avatar
  4. 4 Posted by Davyd McColl on 28 Apr, 2020 04:58 AM

    Davyd McColl's Avatar

    No, I haven't. I'll try give this a go, but I'm concerned about whether
    it's the right thing to do - it's a bit of a hack.

    As mentioned earlier, this builds fine on my win10 laptop as well as on the
    CircleCI build environment. However CircleCI requires write permissions to
    GitHub repos (I think incorrectly because the docs say it's to enumerate
    repos, which AppVeyer does without that permission) so the Apache people
    won't allow it - it's against their policies.

    So, I'll try it, thanks. I've spent literally days trying out different ci
    services and a lot of that has been in trying to solve this exact problem
    on Travis. It's getting a bit frustrating, tbh. Someone on the Apache
    mailing list suggested AppVeyer as a known quantity, and I've been quite
    impressed with the speed of build, so it would be nice to resolve this.

    -d

  5. Support Staff 5 Posted by Feodor Fitsner on 28 Apr, 2020 05:01 AM

    Feodor Fitsner's Avatar

    Is it a public repo? I'd like to take if it is.

  6. 6 Posted by Davyd McColl on 28 Apr, 2020 05:14 AM

    Davyd McColl's Avatar

    Yes, I forked their repo to get their build going again as the project was
    marked dormant for lack of maintainers, so you can find that here:
    https://github.com/fluffynuts/logging-log4net

    The branch I've worked on is called update-build-system. If you have all of
    the .net build requirements, you should be able to build effortlessly using
    my npm scripts. You'll obviously need node, and then run, in the repo:

    npm ci
    npm test

    Optionally, also run:
    npm release

    Test builds in debug mode and runs tests (they don't take long). Release
    rebuilds in release mode and packs a .nupkg. If test completes, then we're
    probably all good as release doesn't do anything too tricky.

    Thanks for taking a look.
    -d

  7. 7 Posted by Davyd McColl on 02 May, 2020 06:55 PM

    Davyd McColl's Avatar

    Hi, I was wondering if you've had any time to check this out?

    Thanks
    -d

  8. 8 Posted by Ivaylo Slavov on 15 Nov, 2020 04:33 PM

    Ivaylo Slavov's Avatar

    Hello,

    A similar situation as Davyd McColl happened to me today. I have experienced the same issue with the Visual Studio Image 2019 -- yesterday my build ran fine, while today it constantly failed with finding net35. I was already having the FrameworkOverride fix:

    <FrameworkPathOverride>$(MSBuildProgramFiles32)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client</FrameworkPathOverride>

    in the relevant projects but nevertheless my builds did not work.

    I ended up adding this nuget package (https://www.nuget.org/packages/jnm2.ReferenceAssemblies.net35) as a dependency to the broken projects and my builds ran fine again. I assume this package provides a more durable fix, so maybe you can give it a try if the problem comes back.

    Cheers,
    Ivaylo Slavov

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac