Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Can no longer build simple netstandard2.0 project after upgrading from 2.1.302 to 2.1.400. #855

Closed
ghost opened this issue Aug 21, 2018 · 2 comments

Comments

@ghost
Copy link

ghost commented Aug 21, 2018

I have a very simple netstandard2.0 project that has been building in CI for a little while now and a couple of days ago the builds started failing. I couldn't make heads or tails of it because the project built just fine on my macbook pro. I eventually noticed that CI was pulling down a microsoft docker container using tag 2.1-sdk that was now running version 2.1.400 of the sdk. My macbook was running 2.1.302. I upgraded the macbook and boom, couldn't build locally either.

The error that I'm seeing is as follows:

error CS0012: The type ‘Attribute’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.

The offending code:

using System;
using Amazon.DynamoDBv2.DataModel;

namespace Foo.Data.Profiles.Models
{
    [DynamoDBTable("Profiles")]
    public class Profile
    {
        [DynamoDBHashKey]
        public string UserId { get; set; }

        public string FirstName { get; set; }

        public string LastName { get; set; }

        public string Bio { get; set; }

        public string Image { get; set; }

        public DateTime CreatedAt { get; set; }

        public DateTime UpdatedAt { get; set; }
    }
}

The .csproj file:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <NeutralLanguage>en-US</NeutralLanguage>
    <TargetFramework>netstandard2.0</TargetFramework>
    <PackageVersion>0.1.0.0</PackageVersion>
    <PackageId>Foo.Data.Profiles</PackageId>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="AWSSDK.DynamoDBv2" Version="3.3.12.1" />
    <PackageReference Include="Bar.Library" Version="1.0.0" />
  </ItemGroup>

</Project>

The build script:

#!/bin/bash

set -e

cd src/Foo

dotnet build -c Release

The nuget.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="true" />
    <add key="automatic" value="true" />
  </packageRestore>

  <packageSources>
    <add key="Bar Stuff" value="https://www.myget.org/F/bar/api/v3/index.json" />
    <add key="Foo Stuff" value="https://www.myget.org/F/foo/api/v3/index.json" />
  </packageSources>
</configuration>

I've been trying a number of things over the past couple of days but no luck. Any direction would be appreciated.

@ghost
Copy link
Author

ghost commented Aug 21, 2018

I was able to resolve this by changing the target framework from netstandard2.0 to netcoreapp2.1. It seems that the AWS libraries are apparently not able to be compiled against dotnet standard as of 2.1.400. I'm not too concerned about it in the immediate future since I don't have any plans to use this code in a dotnet framework project, but I would really like to understand why this stopped working all of a sudden.

@ghost
Copy link
Author

ghost commented Aug 27, 2018

resolved

@ghost ghost closed this as completed Aug 27, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants