-
Notifications
You must be signed in to change notification settings - Fork 686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing Launch.json Auto-Creation for dotnetcore classlib template #2703
Comments
@akshita31 Can you take a look? |
@parsalotfy Thanks for writing up such good steps. However, this is actually how things are designed to work. The issue is this: if you have a class lib project, then that project isn't launchable by itself -- you would need to add another project, such as a console app, or ASP.NET app which referenced the class library if you wanted to launch the project. The C# extension still offers debugging templates in this scenario because you might have some other executable which isn't a project in your workspace that you can use to launch a process which loads your class library (ex: something that loads your class library with reflection) and VS Code is designed around the idea that you can string together any tools you want. But in this scenario the C# extension has no idea how you want your scenario configured, so everything it outputs is very generic and you need to roll build tasks and configure launch.json yourself. |
Thank you, I know the scenario is generic but I think it would be a good idea to have a default behavior for building the library. My Launch.json configuration for building my class library with F5
My Task.json configuration for building my class library with F5.
|
@parsalotfy to be clear: your launch.json doesn't look like it would work - that should just give you a cryptic error in your console like:
|
@gregg-miskelly We could offer to generate tasks.json but not launch.json for class libraries. What do you think? |
Sounds reasonable to me. |
@rchande I fixed things so we still don't automatically prompt to generate tasks.json, but if one explicitly asks for one by executing '.NET: Generate Assets for Build and Debug', we will create one. Here was my thinking:
|
@gregg-miskelly Sounds reasonable to me. |
OMFG why so much overhead and problems to have a simple extension work! Thumbs down.... |
Environment data
dotnet --info
output:.NETCore SDK version 2.1.400
VSCode version 1.29.1 (latest in time of writing this)
CsharpExtension version 1.17.1
OS Windows x64
Steps to reproduce
All the problem is creating, building and debugging the dot net core class library.
Expected behavior
when I create a Console project using this command :
dotnet new console -o A1
, the C# extension automatically create bin folder and ask me :.
and after clicking yes, the extension creates and configured launch.json and task.json for me :
and after pressing F5 , it compiles and builds successfully.
But ...
Actual behavior
But when I create class library using this command :

dotnet new classlib -o A1
the extension does NOT show me any notification that ask me if I would like to add assets or not
I mean the extension does NOT create Launch.json and Task.json for me and clearly does not configure them.
.
When I press F5 the command palette asks me to select my environment and I click on .Net Core
Then it generates Launch.json for me BUT Wrongly and when I press F5 to build it , I get this Error :
this is too annoying to have this behavior in this rich text editor and extension.
Thank you for your good Extension 🥇
The text was updated successfully, but these errors were encountered: