Jump to content

Cannot resolve assembly: netstandard


Recommended Posts

I think that means you're not compiling for .NET 3.5, which is required for a KSP mod. I think netstandard is a really recent thing.

If you open your csproj file in a text editor, it should say this somewhere (sorry, I don't know how VS's GUI displays it):

    <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>

Also check that the references (also in the csproj) only include DLLs that are in some subfolder of the KSP folder, such as:

    <Reference Include="System">
      <Private>false</Private>
    </Reference>
    <Reference Include="System.Data">
      <Private>false</Private>
    </Reference>
    <Reference Include="System.Xml">
      <Private>false</Private>
    </Reference>
    <Reference Include="Assembly-CSharp">
      <HintPath>KSP_x64_Data\Managed\Assembly-CSharp.dll</HintPath>
      <Private>false</Private>
    </Reference>

 

Link to comment
Share on other sites

Thanks, I solved the problem by editing the .csproj file like you suggested

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

  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>

I know you said v3.5 but all the nifty compiler features that I enjoy so much are in v4.6 - it compiles and runs just fine.

 

but, even after solving this problem, I've run into a few others. I'll figure them out.... thanks a ton!

Link to comment
Share on other sites

49 minutes ago, Xyphos said:

Thanks, I solved the problem by editing the .csproj file like you suggested


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

  <PropertyGroup>
    <TargetFramework>net46</TargetFramework>
  </PropertyGroup>

I know you said v3.5 but all the nifty compiler features that I enjoy so much are in v4.6 - it compiles and runs just fine.

 

but, even after solving this problem, I've run into a few others. I'll figure them out.... thanks a ton!

You will get problem with 4.6. 

Which compiler feature do you need ? Because you can compile C#7 to .NET 3.5 fine. C#version and .NET version are not the same things.

Link to comment
Share on other sites

1 minute ago, Xyphos said:

ScreenMessages.PostScreenMessage($"Node set for {job} at {UT}...");

because I hate String.Format's ugly face.

That's C#7, not .NET 4.5. You can edit your project to compile to use 7 (How).

Link to comment
Share on other sites

23 minutes ago, Benjamin Kerman said:

Are namespaces like System.Linq or System.Collections in .NET or in C#7 or C#6?

What's the difference between the C# number and .NET version? 

.NET is a framework. A set of libraries provided by Microsoft and are compiled to run on the CLR virtual machine.

C# is a programming language. It is commonly complied to run with the .NET framework on the CLR virtual machine. 

Other framework working with CLR is the modern  .NET Core.

Link to comment
Share on other sites

43 minutes ago, Benjamin Kerman said:

Are namespaces like System.Linq or System.Collections in .NET or in C#7 or C#6?

What's the difference between the C# number and .NET version? 

C# version has to do with which version of the compiler you need to compile the code. When C# first came out, $"{expression}" was not valid syntax, but Microsoft added that later, in C# 6. So you need the C# 6 or later compiler to use it.

.NET version has to do with what version of the runtime you need to execute compiled code. One example is System.Linq; this was added in .NET 3.5, and so if your code uses it, you can't run that code on .NET 2.0.

Sometimes it's possible for a newer compiler to generate compiled code that runs on older versions of .NET while still supporting newer language features; the $"{expression}" syntax is an example of this. It's essentially just syntactic sugar on top of String.Format, so the C# 6 compiler can create compiled code that will run in .NET 3.5 even though this language feature didn't exist when .NET 3.5 was released.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...