Trying to set environment in VSCode launch.json on OS X - asp.net

I'm building an ASP.Net Core RC2 MVC Application on OS X
I don't seem to be able to set my environment for development
I think I should be able to add within my launch.json file:
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
I've tried adding it within the "name": ".NET Core Launch (web)" section. But "env" is not recognised. The version of the launch.json file is set as "version": "0.2.0", The error i get shown in the editor is Property env is not allowed
Has anyone got this working on OS X?
Thanks.

The issue is with OmniSharp for VS Code, as found at Issue #172 on their repo.
If you install their most recent preview release, the environment variable will work as intended. Download the VSIX file, and open it using the Open File dialog in VS Code. When the official release comes out, it will still suggest extension updates as per normal.

Related

Unable to debug WSL2 with VS 2022 - invalid 'cwd' value

I am trying to debug from WSL2 using my VS 2022 IDE in Windows, but I get the following error:
The cwd value does indeed look wrong, but how do I fix it?
I am using .netcore 6.0.101, Ubuntu 20.04.3 and Windows 11.
launchSettings.json:
{
"profiles": {
"WSL": {
"commandName": "WSL2",
"launchBrowser": false,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "local"
},
"applicationUrl": "https://localhost:56962;http://localhost:56963",
"distributionName": "Ubuntu"
}
}
}
PS C:\Users\me> wsl -l -v
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop Running 2
docker-desktop-data Running 2
This has been fixed in 17.4 Preview 5.
The latest Preview releases are available for download here.
I tried to search some useful information for you, somebody said this is permisson issue. But I this below description is correct.
Currently the extension only support opening projects that are stored in the windows disks (it leverages WSLs automount feature).
Related Post:
Debug Your .NET Core Apps in WSL 2 with Visual Studio
In Visual Studio 2022:
Go to the project properties (right click on the project name in the Solution Explorer, then Properties on the pop up menu).
Then, write in the search bar "working directory" and click on "Open debug launch profiles UI" here you'll find the "Working Directory" setting where you should set the wsl2 path you need.
You have this error because Windows doesn't know about linux path used on WSL.
But you can access your WSL2 directories on Windows using \\wsl$ path.
If your WSL2 machine name is Ubuntu, you need to define cwd value with following path:
\\wsl$\Ubuntu\home\<the_rest_of_the_path_you_need>

.net core package restore failed

Package restore
Package restore failed in ASP.NET Core 1.1.
Note: I am targeting following in my project.
"frameworks": {
"net461": { }
},
Recently I upgraded my project from ASP.NET Core 1.0 to 1.1 and it worked fine on my old laptop until I switched the project to fresh new laptop, and installed visual studio 15. Here is the configuration of the VS 15.
I have also installed the required SDK as mentioned on this link
https://jeremylindsayni.wordpress.com/2016/11/20/upgrading-from-net-core-1-0-t0-1-1-with-visual-studio-2015/
Now my project.json file looks likes this.
And global.json looks like this.
{
"projects": [ "." ]
}
But as you can see the packages are not loading as expected. When I run dotnet restore from the package manager console I get something like this.
Any ideas ??
I fixed same issue when i add file
If you see this error with adding some code file for example Controller, View etc.
Than one of reasons is CodeGeneration package failed when you try to add some file.
add nuget package which is
Microsoft.VisualStudio.Web.CodeGeneration.Design

Errors creating ASP.NET Core 1 application

I have VS2015 and I am attempting to create an ASP.NET Core 1.0 application.
I select the template and also leave the defaults (host in azure and identity security set to individual).
I enter the details for the Azure instance and then when the project loads in VS2015 it errors straight away against DNX 4.5.1 and DNX Core 5.0. I have tried package restore but no luck. in the project.json file I have:
{
"frameworks": {
"dnx451": { },
"dnxcore50": { }
},
#Adrien got me onto the right track. I used the Nuget command line to install the latest release for Newtonsoft.Json. It successfully installed and I could see the change to the version in the project.json file. However I still had the same error displaying. Although it had updated the main file, the project.lock.json file didn't get it's references updated at the same time. I had to close my project and re-open before the reference change took effect to the lock file.

Is Meteor supported in VS Code?

Is this something Visual Studio Code needs to add or is there a way to make it work?
Visual Studio Code can provide intellisense and warnings for Meteor. To get that you simply need to add the TypeScript definition file for Meteor to your project folder. You don't need to be coding with TypeScript for this to work, it works just fine for JavaScript too.
An easy way to add that file is to use the TypeScript Definition Manager. Open a command prompt, navigate to your project folder and then type tsd query meteor --action install. That will add all the necessary bits and you should see that the Meteor specific syntax is no longer green squiggly underlined in VS Code.
If you don't yet have TypeScript Definition Manager installed there's a good guide to that in the official VS Code documentation.
There's also a lot of voices pushing for better Meteor support to be built into VS Code, it's currently the 16th most requested feature.
For those who are looking for debugging meteor app in IDE:
You can run your app in debug mode using meteor debug and then attach debugger to port number 5858, It should work for all type of node.js debuggers e.g. Visual Studio, Visual code, Webstorm etc because they all have "attach" debugger option next to "debug" option.
Jetbrains Webstorm 9 & 10 also support Meteor: http://blog.jetbrains.com/webstorm/2014/09/meteor-support-in-webstorm-9/
There was project for Visual Studio available: https://meteortools.codeplex.com/, but it hasn't been maintained for about 2 years and sadly doesn't provide any releases / downloads.
a working meteor react front end debug session
1 launch.json
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "attach",
"name": "attach to meteor",
"port": 9229,
}
]
}
note the port number is 9229
run with package.json script "debug": "meteor debug"
yarn run debug

How does kpm manage content folders in a NuGet package?

I'm running Visual Studio 15 Preview, and started a new project: ASP.NET Web Application > ASP.NET 5 Empty. I then opened project.json and modified it to add AngularJS.Core 1.3.4 as follows:
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0-beta1",
"AngularJS.Core": "1.3.4" // I only added this line
},
I see the package downloaded and added to my packages folder, but the nupkg file has a content folder (with the actual *.js files I want added), but those files aren't being added to my project. There are no error messages or warnings of any kind (at least none via the package manager log).
I have also tried running kpm --verbose install ... and kpm --verbose restore via the command line, and I don't see anything useful for solving this.
I know I can manage this manually, but am I missing something? Is this a bug, or am doing this wrong, or are my expectations incorrect? I'm new to this ASP.NET vNext stuff, and this is my first time jumping into it.
It doesn't. KPM currently doesn't do anything with packages that contain content/powershell scripts/transforms etc.

Resources