13

Do I use the .NET CLI if I want to create an ASP.NET Core 1.0 app that uses the .NET Framework? Is .NET CLI only for the new .NET Core library or both Core and .NET 4.6?

3
  • 1
    Are you referring to the Common Language Infrastructure or Command Line Interface? (They had to know it was going to cause confusion using CLI when CLI was already a well-establshed abbreviation.) Commented Jul 6, 2016 at 17:16
  • Command Line Interface Commented Jul 6, 2016 at 17:17
  • Thanks for clarifying - I thought that maybe you wanted to produce a CLI-compliant application/library. Commented Jul 6, 2016 at 17:20

3 Answers 3

8

You can use dotnet cli for full framework apps and libraries as well. You just need to use the appropriate framework tag - for example "net46" to target .NET 4.6. You can target multiple frameworks, too:

For example, from my Noda Time library:

"frameworks": {
  "net45": {
    "frameworkAssemblies": {
      "System.Xml": "",
      "System.Numerics": ""
    }
  },
  "netstandard1.1": {
    "buildOptions": {
      "define": [ "PCL" ]
    },
    "dependencies": {
      "System.Diagnostics.Debug": "4.0.11",
      "System.Globalization": "4.0.11",
      "System.Linq": "4.1.0",
      "System.Resources.ResourceManager": "4.0.1",
      "System.Runtime.Extensions": "4.1.0",
      "System.Runtime.Numerics": "4.0.1",
      "System.Runtime.Serialization.Xml": "4.1.1",
      "System.Threading": "4.0.11",
      "System.Xml.XmlSerializer": "4.0.11"
    }
  }
}

The PCL preprocessor symbol will be renamed to "DOTNET_CORE" or similar at some point - it's only there because I have a bunch of code that uses it for conditional compilation back when I used to target portable class libraries.

You can still also target portable class libraries, by the way... so a single package can target many different versions.

Sign up to request clarification or add additional context in comments.

Comments

7

Do I use the CLI if I want to create an ASP.NET Core 1.0 app that uses the .NET Framework?

The .NET CLI is for either, the distinction is actually made in the project.json file. For example you can use the following command to compile/build the ASP.NET Core application while the application is actually targeting the full-framework:

dotnet build

Here is what an example project.json would look like targeting .NET 4.6.

{
  "frameworks": {
    "net46": { }
  }
}

For more details I always encourage people to refer to the documentation found here. Likewise, since this is open-source (which is amazing) you can look at the source to understand how it is that this is intended to be used.

Comments

4

CLI is just tooling. What your application will use to run is not coupled to tooling (i.e. as long as the tooling is able to create the correct application for your target framework it does not matter how tooling runs). Rather, in your project.json file you specify the target framework in form of target framwork moniker (e.g. net451 for .NET Framework 4.5.1 or netcoreapp1.0 for .NET Core apps etc.)

5 Comments

Do I need to get the CLI separately or will upgrading to Visual Studio 2015 Update 3 automatically install CLI for me?
You need to install web tooling on top of Update3. You can get VS tooling from microsoft.com/net/download (NET Core Tooling Preview 2 for Visual Studio 2015)
@Sam, this is part of the instructions found here... microsoft.com/net/core#windows
@DavidPine I was just there and I still have a question. Does installing the .NET Core 1.0 for Visual Studio install everything I need i.e. .NET Core framework, CLI and .NET Core support in Visual Studio?
@Sam you need the .NET Core for Visual Studio downloadable here. First install VS 2015 Update 3, then the CLI as the steps indicate.

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.