3

I am trying to compile some C# code with .NET Core. My last attempt was hindered by YamlDotNet not supporting .NET Core, but that has changed.

So, I set up a project like this:

<Project Sdk="Microsoft.NET.Sdk">
  <ItemGroup>
    <ProjectReference Include="..\..\YamlDotNet\YamlDotNet\YamlDotNet.csproj" />
  </ItemGroup>
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworkIdentifier>.NETCoreApp</TargetFrameworkIdentifier>
    <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
  </PropertyGroup>
</Project>

I ran:

dotnet restore

That was successful. Then I tried:

dotnet build

This yielded the following error:

/usr/share/dotnet/sdk/1.0.1/Microsoft.Common.CurrentVersion.targets(1111,5):
  error MSB3644: The reference assemblies for framework ".NETCoreApp,Version=v1.0"
  were not found. To resolve this, install the SDK or Targeting Pack for this
  framework version or retarget your application to a version of the framework for
  which you have the SDK or Targeting Pack installed. Note that assemblies will be
  resolved from the Global Assembly Cache (GAC) and will be used in place of
  reference assemblies. Therefore your assembly may not be correctly targeted for
  the framework you intend.
  [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
/usr/share/dotnet/sdk/1.0.1/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Sdk.targets(92,5):
  error : Cannot find project info for '/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj'.
  This can indicate a missing project reference.
  [/work/yaml-editor/docker/src/dotnet/dotnet.csproj]

I am using the official microsoft/dotnet:1.0-sdk docker container, so I don't understand why .NETCoreApp,Version=v1.0 is missing. How can I fix the error?

Update:

I figured out that I have to configure <TargetFramework>netstandard1.3</TargetFramework> which is also present in YamlDotNet.csproj. However, now I get this error:

/usr/share/dotnet/sdk/1.0.1/Microsoft.CSharp.CurrentVersion.targets(133,9): warning MSB3884: Could not find rule set file "MinimumRecommendedRules.ruleset". [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Core/YamlException.cs(113,30): error CS0115: 'YamlException.GetObjectData(SerializationInfo, StreamingContext)': no suitable method found to override [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Core/YamlException.cs(112,26): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Core/YamlException.cs(112,57): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Core/YamlException.cs(112,112): error CS0246: The type or namespace name 'Flags' could not be found (are you missing a using directive or an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Core/YamlException.cs(112,120): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Serialization/Utilities/TypeConverter.cs(45,26): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Serialization/Utilities/TypeConverter.cs(45,52): error CS0234: The type or namespace name 'Permissions' does not exist in the namespace 'System.Security' (are you missing an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Serialization/Utilities/TypeConverter.cs(45,107): error CS0246: The type or namespace name 'Name' could not be found (are you missing a using directive or an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
Serialization/Utilities/TypeConverter.cs(47,54): error CS0234: The type or namespace name 'TypeConverter' does not exist in the namespace 'System.ComponentModel' (are you missing an assembly reference?) [/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj]
/usr/share/dotnet/sdk/1.0.1/Sdks/Microsoft.NET.Sdk/build/Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for '/work/yaml-editor/docker/YamlDotNet/YamlDotNet/YamlDotNet.csproj'. This can indicate a missing project reference. [/work/yaml-editor/docker/src/dotnet/dotnet.csproj]
make: *** [build/bin/dotnet-event] Error 1

I remember to have seen similar errors when I last tried this, but I wonder why it still happens, since YamlDotNet claims to support .NET Core.

11
  • Did you try <TargetFramework>netcoreapp1.0</TargetFramework>? Commented Aug 23, 2017 at 20:52
  • @JoséPedro yes, that does not work because YamlDotNet.csproj has the <TargetFrameworkIdentifier> / <TargetFrameworkVersion> combo configured, so if I use what you propose, I get an error about mismatching target frameworks. Commented Aug 23, 2017 at 20:56
  • Did you try swapping the PropertyGroup and the ItemGroup? Commented Aug 23, 2017 at 21:02
  • @JoséPedro that seems to be irrelevant. Added update to question. Commented Aug 23, 2017 at 21:05
  • 2
    Please update to a recent version of the .NET Core SDK. The version you are using (1.0.1) has been superseded by 1.1.0 and 2.0.0 Commented Aug 23, 2017 at 21:56

1 Answer 1

1

I had the same error, which I resolved by adding:

using YamlDotNet.RepresentationModel;

Try adding one of the four namespaces and see which works:

using YamlDotNet.Serialization
using YamlDotNet.RepresentationModel
using YamlDotNet.Helpers
using YamlDotNet.Core
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for answering. I'm afraid this project is long gone and I can't verify whether this was the problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.