question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add global.json to csharp template

See original GitHub issue

This is a bug report

Description

.Net core has changed the way they define projects and solutions. The CSharp template created by the framework works well as long as you can build it with an older SDK version. So, if you’ve just dowload the last version of .Net core, create a CSharp project using serverless and try to run commands like dotnet restore or dotnet build you will get an error.

The way to avoid it is to create a build.json file with the following contents:

{
    "sdk": {
        "version": "1.0.0-preview2-003131"
    }
}

When you run a dotnet command, the CLI tries to find this file in your current folder or any parent folders. The recommendation is to put the file at solution level, not at project level. So, it would be great if your framework creates the file in the folder that the user run the create command, not in the created folder.

To check that the CLI is using the right version:

I’m using the version 1.15.3 of the serverless framework.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
vgaltescommented, Jun 16, 2017

Hello both,

that’s awesome. I agree it would be good idea to pin the SDK version in the global.json. Things change quickly in the .Net core land 😛

So I think we can close this issue waiting for @slang25 PR? Let me know if I can help you.

I’ve noticed that there’s no C# or F# template when using the Azure provider. It would be great to add one there as well.

Thanks!

1reaction
slang25commented, Jun 16, 2017

Hello again

Good news, I have found what was causing the issues on the previous PRs, when zipping up the package the aws dotnet lambda sdk would use zip if it found it on your path, if not it would use the built in .NET compression library, when it did the latter the files in the zip had the wrong permission.

I will resurrect both PRs later today and bring them up to scratch. I think pinning the sdk version a global.json is a good idea, as the sdk on the machine will move forwards while we’ll need to match what AWS support.

Read more comments on GitHub >

github_iconTop Results From Across the Web

global.json overview - .NET CLI - Microsoft Learn
The global.json file allows you to define which .NET SDK version is used when you run .NET CLI commands. Selecting the .NET SDK...
Read more >
c# - there is no project.json, global.json ... etc on .NET Core ...
So there is no project.json nor global.json in .net core stack any more. The alternative for project.json is *.csproj and for global.json is ......
Read more >
Should I use global.json? - Alessio Franceschelli
Let me first introduce what this file is. The global.json file in the root of your project (or even in the root of...
Read more >
How to change the target dotnet SDK with global json ...
Demo Repohttps://github.com/Chronostasys/Blazor.
Read more >
The power of the global.json - David Pine
The global.json file sits out at the solution directory-level and literally has one of the simplest JSON schemas you will ever see. The...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found