Loaded .csproj project is not refreshed when 'dotnet restore' is executed
See original GitHub issueEnvironment data
dotnet --info
output:
.NET Command Line Tools (1.0.0-preview4-004233)
Product Information: Version: 1.0.0-preview4-004233 Commit SHA-1 hash: 8cec61c6f7
Runtime Environment: OS Name: Windows OS Version: 10.0.14393 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\1.0.0-preview4-004233
VS Code version: 1.8.1 C# Extension version: 1.6.2
Steps to reproduce
Run…
dotnet new
Add to csproj:
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
Add to program.cs:
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
Total text of csproj is (I also updated the .NET versions to Core 1.1.0):
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
</ItemGroup>
</Project>
Total text of program.cs:
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
public class Startup
{
public void Configure(IApplicationBuilder app)
{
app.Run(
context => {
return context.Response.WriteAsync("Hello Scott");
}
);
}
}
public class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
Expected behavior
Omnisharp should be able to identify new packages and treat them the same as references in the old json version of the config.
Actual behavior
AspNetCore
in each using statement has a red underline with message “namespace does not exist”.
Once adding classes such as IApplicationBuilder
or WebHostBuilder
to the code, they will not be recognized either. However, the syntax is correct, as demonstrated by being able to run dotnet run
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (5 by maintainers)
Top GitHub Comments
Yes, I totally agree. The two issues are related though.
That is, I have a fix for the issue where the project doesn’t update its references after a
dotnet restore
until you restart.