Microsoft.AspNetCore.Hosting.Abstractions manifest definition does not match the assembly reference - .net-core

When I run the Entitfy framework core command add-migration MyMigrationName in a class library I get the following error
Could not load file or assembly
'Microsoft.AspNetCore.Hosting.Abstractions, Version=1.1.1.0,
Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its
dependencies. The located assembly's manifest definition does not
match the assembly reference. (Exception from HRESULT: 0x80131040)
Funny thing there is no reference in my application to Abstractions.
Here is my csproj
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup Label="Globals">
<SccProjectName>SAK</SccProjectName>
<SccProvider>SAK</SccProvider>
<SccAuxPath>SAK</SccAuxPath>
<SccLocalPath>SAK</SccLocalPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net452</TargetFramework>
<AssemblyName>MyProjectName</AssemblyName>
<OutputType>Library</OutputType>
<PackageId>MyProjectName</PackageId>
<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace>MyProjectName</RootNamespace>
</PropertyGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="DocumentFormat.OpenXml" Version="2.5.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.2" />
<PackageReference Include="Microsoft.CSharp" Version="4.3.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.1.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.2" />
<PackageReference Include="System.Collections" Version="4.3.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Runtime" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
</ItemGroup>
</Project>

In order to get NuGet to add the appropriate binding redirects to class library projects, you need to add the following to your *.csproj file.
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>

Related

In DevExpress Template Gallery, XAF Controllers do not appear

In DevExpress Template Gallery (version 21.1), XAF Controllers do not appear.
I use .NET 5 and Visual Studio Pro version 16.11.2
How can I fix this problem?
There are not XAF Controllers when I want to use them.
(I have tested in *.win, *.Module.win and in *.Module)
TimeReport.Win.csproj:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<ApplicationIcon>ExpressApp.ico</ApplicationIcon>
<Deterministic>false</Deterministic>
<AssemblyVersion>1.0.*</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Controllers\**" />
<EmbeddedResource Remove="Controllers\**" />
<None Remove="Controllers\**" />
<Page Remove="Controllers\**" />
</ItemGroup>
<ItemGroup>
<None Remove="Model.xafml" />
<None Remove="Images\Logo.svg" />
</ItemGroup>
<ItemGroup>
<Content Include="Model.xafml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Images\Logo.svg" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DevExpress.ExpressApp" Version="21.1.5" />
<PackageReference Include="DevExpress.ExpressApp.Security.Xpo" Version="21.1.5" />
<PackageReference Include="DevExpress.ExpressApp.Validation.Win" Version="21.1.5" />
<PackageReference Include="DevExpress.ExpressApp.Win" Version="21.1.5" />
<PackageReference Include="DevExpress.ExpressApp.Xpo" Version="21.1.5" />
<PackageReference Include="DevExpress.Persistent.Base" Version="21.1.5" />
<PackageReference Include="DevExpress.Persistent.BaseImpl" Version="21.1.5" />
<PackageReference Include="DevExpress.RichEdit.Export" Version="21.1.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\TimeReport.Module.Win\TimeReport.Module.Win.csproj">
<Private>True</Private>
</ProjectReference>
<ProjectReference Include="..\TimeReport.Module\TimeReport.Module.csproj">
<Private>True</Private>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="TimeReportORMDataModel.xpo.diagram">
<AutoGen>True</AutoGen>
</None>
</ItemGroup>
</Project>
I've ran into this issues and found out that this is a known issue with the 21.1.5 installer. There is a hotfix available:
Core - XAF templates are not available in the Template Gallery for XAF Blazor projects

.NET Core 2.1 Lambda function fails at runtime with FileNotFoundException for netstandard

I have a .NET Core 2.1 Lambda function. The csproj file looks like this:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<AWSProjectType>Lambda</AWSProjectType>
</PropertyGroup>
<ItemGroup>
<None Remove="chromium.br" />
</ItemGroup>
<ItemGroup>
<Content Include="chromium.br">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Amazon.Lambda.Core" Version="1.1.0" />
<PackageReference Include="amazon.lambda.logging.aspnetcore" Version="3.0.0" />
<PackageReference Include="amazon.lambda.serialization.json" Version="1.7.0" />
<PackageReference Include="microsoft.extensions.dependencyinjection" Version="3.1.3" />
<PackageReference Include="microsoft.extensions.logging" Version="3.1.3" />
<PackageReference Include="mono.posix.NETStandard" Version="1.0.0" />
<PackageReference Include="puppeteersharp" Version="2.0.2" />
</ItemGroup>
<ItemGroup>
<Reference Include="HeadlessChromium.Puppeteer.Lambda.Dotnet">
<HintPath>..\HeadlessChromium.Puppeteer.Lambda.Dotnet\HeadlessChromium.Puppeteer.Lambda.Dotnet.dll</HintPath>
</Reference>
</ItemGroup>
</Project>
The project compiles, but at runtime (i.e. in the Lambda environment), the application fails with the message:
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified
How do I correct this?
I realised that the HeadlessChromium.Puppeteer.Lambda.Dotnet.dll I used was compiled against .NET Standard 2.1. Using the .NET Core 2.1 DLL instead solved the problem.

Asp.net core application deploy as exe

I create new application with asp.net core .net framework 4.6.1 not core2 .
When I build application or deploy its relased as .exe not dll.
below is web.config for publish folder :
<aspNetCore processPath=".\Projectxxx.Upload.exe"
stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout"/></system.webServer>
Is that mean the project is out process ?
Also if I get any error give me this message
HTTP Error 502.5 - ANCM Out-Of-Process Startup Failure
I want to make the project in process and run at windows platform only what can be do for that ?
Any help
this is my project file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
<DebugType>full</DebugType>
<UserSecretsId>aspnet-Projectxxx.Upload-332B348E-4A41-4FF3-A789-DD081E38AE8A</UserSecretsId>
<TypeScriptToolsVersion>3.1</TypeScriptToolsVersion>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.CookiePolicy" Version="2.2.8" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="2.2.1" />
<PackageReference Include="Microsoft.AspNetCore.HttpsPolicy" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.2.6" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="2.2.0" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
<PackageReference Include="Microsoft.Web.Administration" Version="11.1.0" />
</ItemGroup>
</Project>
"The in-process hosting model isn't supported for ASP.NET Core apps that target the .NET Framework."
Reference

Exclude wwwroot\dist from build asp.net dotnet core 2.0

I am trying to build asp.net dotnet core app vis CLI but I want to exclude wwwroot\dist\**\* from compilation.
In dist folder I have static file which need to be copied but not compiled. I tried by adding ItemGroup but cannot figure out.
Also I followed this document but there is something which I don't understand and probably diong wrong.
Here si sample configuration:
<ItemGroup>
<Compile Exclude="wwwroot\dist\**\*" />
</ItemGroup>
One of my error is:
error MSB4232: Items that are outside Target elements must have one
of the following operations: Include, Update, or Remove.
It should be like this:
<ItemGroup>
<Compile Remove="wwwroot\dist\**" />
<Content Remove="wwwroot\dist\**" />
<EmbeddedResource Remove="wwwroot\dist\**" />
<None Remove="wwwroot\dist\**" />
</ItemGroup>
But there could be something else in the game. Here is how "default" .net core 2 csproj should look like + "dist" folder ignore:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp1.1</TargetFramework>
<PackageTargetFallback>$(PackageTargetFallback);portable-net45+win8+wp8+wpa81;</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<Compile Remove="wwwroot\dist\**" />
<Content Remove="wwwroot\dist\**" />
<EmbeddedResource Remove="wwwroot\dist\**" />
<None Remove="wwwroot\dist\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.0.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="1.1.2" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.3" />
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.1.2" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.1.2" />
<PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.1.2" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.1" />
</ItemGroup>
</Project>
If you want to have content of folder copied to output and still visible inside VS:
<ItemGroup>
<Compile Remove="wwwroot\dist\**" />
</ItemGroup>
You can also ensure that the items are never added to the project so you don't have to remove them. This can be a bit more performant if the directory is ver large. To add excludes to the default glob pattern, you'd add this to your project file:
<PropertyGroup>
<DefaultItemExcludes>$(DefaultItemExcludes);wwwroot\dist\**</DefaultItemExcludes>
</PropertyGroup>

How to resolve ASP.NET.Core 2 Package restoration related warning and errors

Whenever I start a .NET CORE 2 web App Project With Authentication (i.e. Individual Authentication) I get the following warning:
Package 'Microsoft.Composition 1.0.27' was restored using '.NETPortable,Version=v0.0,Profile=Profile259, .NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project.
The issue doesn't stop here, I am trying to install Microsoft.AspNetCore.Authentication.Cookies and I get the following error:
Package restore failed. Rolling back package changes for project
I tried the following, ALL Failed!
Deleting Nuget.Config
I added <PropertyGroup> <PackageTargetFallback>$(PackageTargetFallback);dotnet</PackageTargetFallback> </PropertyGroup>
restore packages via dotnet restore
Clear Nuget Cache (from Tools>NuGet>Package Manager Settings)
How can I resolve this conflict?
this is my project file
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<UserSecretsId></UserSecretsId>
</PropertyGroup>
<PropertyGroup>
<PackageTargetFallback>$(PackageTargetFallback);dotnet</PackageTargetFallback>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview2-final" />
</ItemGroup>
</Project>
and a snapshot from my screen
The dependency issues have been resolved by adding in .csproj and updating the following packages using NuGet,
<PackageReference Include="Microsoft.Composition" Version="1.0.27" ExcludeAssets="All" />
<PackageReference Include="System.Composition" Version="1.0.31" />
The .csproj is
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<UserSecretsId>***********</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.Cookies" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Identity" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.Composition" Version="1.0.31" ExcludeAssets="All" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="2.0.0-preview2-final" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview2-final" />
<PackageReference Include="System.Composition" Version="1.1.0-preview2-25405-01" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.0-preview2-final" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="2.0.0-preview2-final" />
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0-preview2-final" />
</ItemGroup>
</Project>
Ref, Ref2

Resources