BadImageFormatException while building an UWP unit test project

dennis.doomen's Avatar

dennis.doomen

19 Mar, 2017 06:24 PM

I'm pretty consistently suffering from BadImageFormatExceptions while loading System.Private.CoreLib needed to build a UWP unit test project. Is it possible that nuget package cache is corrupted somehow? Something similar was mentioned here https://developercommunity.visualstudio.com/content/problem/7418/re..., but was resolved using an install/uninstall.

Please see the failing build here https://ci.appveyor.com/project/dennisdoomen/fluentassertions/build...

  1. Support Staff 1 Posted by Feodor Fitsner on 19 Mar, 2017 07:33 PM

    Feodor Fitsner's Avatar

    Install/uninstall VS 2017?

  2. 2 Posted by dennis.doomen on 20 Mar, 2017 11:36 AM

    dennis.doomen's Avatar

    Not sure. It seems the DLLs have been downloaded from Nuget but ended up in the appveyor's account cache. Any change you can clean that folder. I'm trying to debug it using remote desktop, but I can't get in.

  3. Support Staff 3 Posted by Feodor Fitsner on 20 Mar, 2017 03:20 PM

    Feodor Fitsner's Avatar

    Try cleaning up that folder during the build:

    install:
    - rd /s /q C:\Users\appveyor\.nuget\packages\
    

    Let me know if that worked.

  4. 4 Posted by dennis.doomen on 20 Mar, 2017 09:01 PM

    dennis.doomen's Avatar

    Didn’t make a difference. To try a more isolated situation, I’ve created a clean UWP test project with a Cake build script. Also doesn’t work because something is wrong with some CLR assemblies. See https://ci.appveyor.com/project/dennisdoomen/appveyortest

    Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10

  5. Support Staff 5 Posted by Feodor Fitsner on 21 Mar, 2017 12:19 AM

    Feodor Fitsner's Avatar

    Have you tried creating UWP project without Cake to see if that works? Also, I'm not sure yet, but don't you think that UWP tests can only be run on Windows 10 (non-Server OS)?

  6. 6 Posted by dennis.doomen on 21 Mar, 2017 08:30 PM

    dennis.doomen's Avatar

    Dennis Doomen

    [cid:[email blocked]]
    M

    +31 (0)6-47033908

    From: Feodor Fitsner [mailto:[email blocked]]
    Sent: Tuesday, March 21, 2017 1:20 AM
    To: Dennis Doomen <[email blocked]>
    Subject: Re: BadImageFormatException while building an UWP unit test project [Questions #3501]

    Yep, tried that, but it won’t even compile because nuget restore doesn’t work out of the box.

    Are you running your build agents on Windows Server 2016? Because that’s supposed to work.

  7. Support Staff 7 Posted by Feodor Fitsner on 21 Mar, 2017 08:38 PM

    Feodor Fitsner's Avatar

    Visual Studio 2017 image runs on Windows Server 2016.

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