Closed mdmoura closed 8 years ago
Could you list your project.json?
Sure, here it is:
{
"title": "App",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Bogus": "7.1.4",
"FluentValidation": "6.4.0-beta3",
"FluentValidation.AspNetCore": "6.4.0-beta3",
"MediatR": "2.1.0",
"Scrutor": "1.8.0",
"Serilog": "2.0.0",
"Serilog.Extensions.Logging": "1.0.0",
"Serilog.Sinks.Literate": "2.0.0"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [ "dotnet5.6", "dnxcore50", "portable-net45+win8" ]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"settings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
BTW one of the Warnings is on the following code line inside a Controller Action:
return BadRequest(reply);
Tried out a sample app with your project file and I couldn't see the warning. Perhaps try cleaning your packages dir (http://docs.nuget.org/consume/command-line-reference#locals-command nuget.exe locals all -clear
) and your repo and see if that helps at all?
@pranavkm Yes, that solved it. Thanks.
I manually installed "System.Runtime": "4.1.0" . It worked.
I am having this issue too, but nuget locals all -clear
did not solve the issue for me.
tmba:vss thill $ nuget
NuGet Version: 3.5.0.1520
[...]
tmba:vss thill $ nuget locals all -clear
Clearing NuGet HTTP cache: /Users/thill/.local/share/NuGet/v3-cache
Clearing NuGet cache: /Users/thill/.local/share/NuGet/Cache
Clearing NuGet global packages cache: /Users/thill/.nuget/packages/
Local resources cleared.
/Users/thill/projects/vss/vss/CSC:
Warning CS1701:
Assuming assembly reference `Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' matches assembly `Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'.
You may need to supply runtime policy (CS1701) (vss)
Installing System.Runtime
version 4.1.0
also did not solve the issue.
@Phrohdoh, what does your project.json look like?
Ah I see now that this is about a .NET Core project, mine is not built on Core. This is my csproj:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{93B25D37-7F05-4BDA-8683-00D834A6F825}</ProjectGuid>
<ProjectTypeGuids>{349C5851-65DF-11DA-9384-00065B846F21};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<RootNamespace>NemerleWebAPI</RootNamespace>
<AssemblyName>NemerleWebAPI</AssemblyName>
<TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<Optimize>true</Optimize>
<OutputPath>bin</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Core" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Net.Http" />
<Reference Include="LibSlyBroadcast">
<HintPath>..\packages\LibSlyBroadcast.2.0.4.1\lib\net451\LibSlyBroadcast.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Formatting">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.3\lib\net45\System.Net.Http.Formatting.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http">
<HintPath>..\packages\Microsoft.AspNet.WebApi.Core.5.2.3\lib\net45\System.Web.Http.dll</HintPath>
</Reference>
<Reference Include="System.Web.Http.WebHost">
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NodaTime">
<HintPath>..\packages\NodaTime.1.3.2\lib\net35-Client\NodaTime.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Content Include="Web.config" />
<Content Include="Global.asax" />
<Content Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Compile Include="Global.asax.cs">
<DependentUpon>Global.asax</DependentUpon>
</Compile>
<Compile Include="App_Start\WebApiConfig.cs" />
<Compile Include="Controllers\UtcToTimeZoneController.cs" />
<Compile Include="WebApiGlobals.cs" />
<Compile Include="SlyUtils.cs" />
<Compile Include="ConfigSettings.cs" />
<Compile Include="Infrastructure\TextPlainFormatter.cs" />
<Compile Include="Controllers\InterceptController.cs" />
<Compile Include="Controllers\CampaignController.cs" />
<Compile Include="Infrastructure\JsonUtils.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Controllers\" />
<Folder Include="Infrastructure\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<MonoDevelop>
<Properties>
<XspParameters Port="8080" Address="127.0.0.1" SslMode="None" SslProtocol="Default" KeyType="None" CertFile="" KeyFile="" PasswordOptions="None" Password="" Verbose="True" />
</Properties>
</MonoDevelop>
</ProjectExtensions>
</Project>
Before you do anything drastic or laborious, try closing and reopening VS. That solved it for me.
@Phrohdoh I'm not entirely sure what might cause your issue. @DamianEdwards where would this issue go?
I'd log it in https://github.com/NuGet/Home/issues I think
Usually I am able to solve this by deleting the DLL files, restart VS and rebuild the Application.
But this keeps happening and is really annoying.
Any ETA for a solution to this issue?
@pranavkm Came across the same problem and your solution worked for me as well. Thanks.
I got the same warning after adding EF to asp.net core. this is my project.json:
{
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"dependencies": {
"Microsoft.ApplicationInsights.AspNetCore": "1.0.2",
"Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
"Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0",
"Microsoft.AspNetCore.Authorization": "1.1.0",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.Core": "1.1.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.Binder": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.IdentityModel.Protocols.OpenIdConnect": "2.1.0",
"Microsoft.NETCore.App": "1.1.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
"Newtonsoft.Json": "9.0.1",
"WindowsAzure.Storage": "7.2.1",
"Microsoft.EntityFrameworkCore.Design": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"web.config",
"appsettings.json",
"appsettings.*.json",
"LICENSE.txt"
]
},
"scripts": {
"prepublish": [ "npm install", "npm recompileapp" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"runtimes": {
"win10-x64": {}
},
"userSecretsId": "....."
}
@guybartal I tried your project locally and that don't see this issue. Are you able to consistently repro it after clearing your NuGet caches? See https://github.com/aspnet/Mvc/issues/5050#issuecomment-233974980 for details on how to go about it.
Bit of a tangent, I'd also recommend not mixing long term support packages ("Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.0.0, "Microsoft.EntityFrameworkCore.SqlServer": "1.0.1"
) with 1.1.0 bits. The 1.1.0 versions of these packages is part of the supported matrix.
Are there any updates to the new netcoreapp1.1 projects using .csproj files? I have been working with them, and am aware they are alpha, but wanted to see if a solution existed?
I have tried the restore and tried dotnet restore after clearing the entire nuget cache, but no luck
@nteague22 what about them?
In VS Code, I get the same issue of a constant warning to supply runtime policy, that it mismatches the versions. It may be from using SDK 3 with VS Code, and I was checking to see if the csproj format would get attention outside of VS2017
What are the repro steps?
@davidfowl I am using Visual Studio Code with ASP.NET 1.1 and I keep getting the same problem even after cleaning local package cache. Here is my present csproj file:
<Project>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" />
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<PropertyGroup>
<AssemblyName>MVCProj</AssemblyName>
<UserSecretsId>c386e766e686lskdjfli2o3iu32oi3</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<Compile Include="**\*.cs" />
<EmbeddedResource Include="**\*.resx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="Microsoft.NETCore.App" Version="1.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Web" Version="1.0.0-alpha-20161104-2-112">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Tools" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.AspNetCore.ResponseCaching" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.ResponseCompression" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0-msbuild1-final" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.2-beta1" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0-msbuild1-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild1-final" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="Prepublish" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
<Exec Command="npm install" />
<Exec Command="bower install" />
<Exec Command="gulp clean" />
<Exec Command="gulp build" />
</Target>
</Project>
I added the code line to somehow try to solve the problem:
<PackageReference Include="System.Runtime" Version="4.3.0" />
But does not seem to help ...
This problem has been happening in VS 2015, VS 2017 and Visual Studio Code with project.json or .csproj file.
Cleaning the cache or deleting the content of BIN folder sometimes solves it for a while but I get it again very soon ... Not sure what triggers it ...
It looks similar to https://github.com/OmniSharp/omnisharp-vscode/issues/967 ?
This problem has been happening in VS 2015, VS 2017 and Visual Studio Code with project.json or .csproj file.
But I'm looking for a repro and based on what you wrote, you're using VS2017 RC right? If you have a separate project.json repro, can you provide that as well?
You shouldn't need the System.Runtime package reference, it's redundant.
@davidfowl In this case I am using Visual Studio Code not VS 2017. And I am using the .csproj not the project.json. I am also using the following version of dotnet tools:
.NET Command Line Tools (1.0.0-preview4-004124)
Product Information:
Version: 1.0.0-preview4-004124
Addind the System.Runtime reference was just an attempt to solve it.
@itn3000 Is right, I wondered if it was Omnisharp or a tooling mismatch from SDK 3.
I had been using the csproj just like the others
@Monte-Christo, closing and reopening the VS worked for me.
just need to restart VS
1- Delete the content of \bin\Debug 2- Rebuild 3- Restart VS
@agokrim, worked for me thanks!
For anyone using VS 2017, in my .NET Core .csproj file, I had an empty <NoWarn>
element, which was the culprit:
<PropertyGroup>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<NoWarn></NoWarn> <<-- REMOVE THIS
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
Builds successfully after removing that <NoWarn>
element.
As @BenjiZombie pointed out, when specifying custom <NoWarn>
, you should include these warnings types 1701;1702;1705.
Actually, when you remove <NoWarn>
element and then look at project properties (GUI Editor of csproj), you will see property Suppress Warnings equals to 1701;1702;1705
So are we saying the default for VS is to turn off these warnings on all projects? If so, isn't that a sign of a problem? Why do these warnings occur? Is there an explanation somewhere as to the meaning of these warnings (in the context of these projects)? I've looked at the doc for these warnings, but that doesn't tell me what sort of gremlins I can expect from ignoring them indefinitely.
On an ASP.NET Core 1.0 RTM project I keep getting the following Warning:
Any idea what might be wrong? Do you need more information?