Can't Build aspnetcore app in VS 2017 RC - asp.net-core

After installing the new VS 2017 RC I'm having issues with building my asnetcore app, here is the error that I am receiving:
MSB4131 The "FilesWritten" parameter is not supported by the
"GenerateRuntimeConfigurationFiles" task. Verify the parameter exists
on the task, and it is a gettable public instance property.
Here is my .csproj file:
<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net462</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net462'">
<RuntimeIdentifier>win7-x64</RuntimeIdentifier>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<PropertyGroup>
<UserSecretsId>aspnet-HobbyQuarters.Web-e309acfb-31ce-4333-a350-edb5d1c073d3</UserSecretsId>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp1.0'">
<PackageReference Include="Microsoft.NETCore.App">
<Version>1.0.1</Version>
</PackageReference>
<PackageReference Include="System.ComponentModel.Annotations" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.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.Extensions.Configuration.EnvironmentVariables" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" 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="Microsoft.AspNetCore.Owin" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink.Loader" Version="14.1.0" />
<PackageReference Include="Nancy">
<Version>2.0.0-barneyrubble</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0-msbuild2-final" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0-msbuild2-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild2-final" />
</ItemGroup>
<ItemGroup>
<Folder Include="Tasks\" />
</ItemGroup>
</Project>

Launch Task Manager
end all existing MSBuild tasks.
Rebuild your project(s). it should work just fine.
Beside. your .csproj looks just fine to me; however, it looks like its setup to run in two different environment perhaps console and aspcore 1.0

So it looks like this was related to having multiple projects with different msbuild tools versions.
I had older projects that weren't using the new convention of referencing the tools: ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web"...
Once I changed them to use this convention everything started to work.

Related

How to exclude Microsoft.CodeAnalysis.* DLLs from publishing

I've written .NET Standard 2.1 library component that relies on Microsoft.AspNetCore.Mvc v2.2.0 package, which indirectly references Microsoft.CodeAnalysis.CSharp.dll, MicrosoftCode.Analysis.dll, and Microsoft.CodeAnalysis.Razor.dll. When I reference my component from .NET Core 3.1 app site and publish the site, Microsoft.CodeAnalysis.* dlls are also published. Is there a way to exclude Microsoft.CodeAnalysis.* dlls from being published? I don't need them for production.
Here are my references from .NET Standard 2.1 CSPROJ file:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Abstractions" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="3.1.8" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.8" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
Thanks in advance!
It looks like the issue comes from referencing the AspNetCore packages directly.
If you can change your class library to target netcoreapp3.1 instead of netstandard, you can replace those by using a FrameworkReference instead. Note that FrameworkReference is only valid for assemblies targetting Net Core 3.x and up. Reference
:
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
Alternatively, if you need to support both netstandard and netcoreapp, you can use conditional references.
<!-- Framework reference for netcoreapp -->
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1' ">
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<!-- Common dependencies -->
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.3.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="3.1.8" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<!-- netstandard dependencies -->
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="Microsoft.AspNetCore.Cryptography.KeyDerivation" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.Abstractions" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.JsonPatch" Version="3.1.8" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Language" Version="3.1.8" />
<PackageReference Include="Microsoft.DotNet.PlatformAbstractions" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="3.1.6" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="3.1.8" />
</ItemGroup>
Note that I had to guess which package references your package library need, so you'll need to adapt as needed

Microsoft.AspNetCore.Identity.EntityFrameworkCore: The located assembly's manifest definition does not match the assembly reference. (0x80131040)

HTTP Error 502.5 - Process Failure when running on dotnet3 core on a remote system, even though it works locally.
Unhandled exception. System.IO.FileLoadException: Could not load file or assembly 'Microsoft.AspNetCore.Identity.EntityFrameworkCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)
My csproj is below:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="7.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Analyzers" Version="3.0.0-preview3-19153-02" />
<PackageReference Include="Microsoft.DotNet.Watcher.Tools" Version="2.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools.Dotnet" Version="2.0.3" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.0.0" />
<PackageReference Include="Pomelo.Entityframeworkcore.Mysql" Version="3.0.0-rc1.final" />
<PackageReference Include="Serilog.AspNetCore" Version="3.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="serilog.sinks.file" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.RollingFile" Version="3.3.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.0.0-rc4" />
</ItemGroup>
</Project>

Getting HTTP error 500.0 While using ASP.net core project

While I trying to make a web APP using .net core This error comes up.
But I have no Error in my code
*.csproj FILE
added here
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AspNetCoreHostingModel>InProcess</AspNetCoreHostingModel>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Identity" version="2.2.0 " />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="1.1.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Areas\Admin\Controllers\Views\Category\" />
</ItemGroup>
</Project>

Tag helper Intellisense issue

Tag helpers are not showing intellisense. Moreover, coloring of their attributes are not working either. What I may be missing? Following is my .cspro file. Note: My _ViewImports.cshtml view contains #addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
.csproj File
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PreserveCompilationContext>true</PreserveCompilationContext>
<AssemblyName>TestProj</AssemblyName>
<OutputType>Exe</OutputType>
<PackageId>TestProj</PackageId>
<UserSecretsId>aspnet-TestProj-6af8ade3-87ff-4468-a9ce-8bb69c696ab8</UserSecretsId>
<RuntimeFrameworkVersion>1.1.1</RuntimeFrameworkVersion>
<PackageTargetFallback>$(PackageTargetFallback);dotnet5.6;portable-net45+win8</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<None Remove="Properties\PublishProfiles\TestProjP.pubxml" />
<None Remove="Properties\PublishProfiles\FolderProfile.pubxml" />
<None Remove="Properties\PublishProfiles\FolderProfile1.pubxml" />
</ItemGroup>
<ItemGroup>
<None Update="wwwroot\**\*;Views\**\*;Areas\**\Views">
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="bootstrap" Version="2.3.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration.Tools" Version="1.1.0-preview4-final" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.1.0">
<PrivateAssets>All</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Session" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="1.1.1" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.0" />
<PackageReference Include="BundlerMinifier.Core" Version="2.3.327" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.1.2" />
<PackageReference Include="EPPlus.Core" Version="1.4.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
</ItemGroup>
</Project>
Refer to this: https://github.com/aspnet/Razor/issues/1628, please re-run the VS 2017 installer as administrator and click ‘Update’ to upgrade to the VS 2017 15.3.3 version, I tried to create a new Asp.NET Core web application to test it, it works fine as below:

AppSettings.*.json files not copied on Publish in ASP.NET CORE 1.1

I am publishing an ASP.NET Core 1.1 project with .csproj file ...
When I publish it the project is compiled and all the files, including the ones in wwwroot are copied, but all appsettings.*.json files are missing.
I am not sure why because I have the following:
<Content Include="**\*.json" />
What am I missing? Here is the complete .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>
<ItemGroup>
<Compile Include="**\*.cs" />
<Content Include="**\*.json" />
<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.Identity" 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.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" />
</ItemGroup>
<ItemGroup>
<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 build" />
</Target>
</Project>
I had a similar issue with four json files I was using as translation files for angular-translate. What I did to include them was explicitly mark them as content.
<Content Include="Language\locale-en.json" />
<Content Include="Language\locale-fr.json" />
<Content Include="Language\locale-es.json" />
<Content Include="Language\locale-pt.json" />