dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.45k stars 10.03k forks source link

Upgrade from .net core 1.0 to 2.0 preview 2 warning #2108

Closed huytnd closed 6 years ago

huytnd commented 7 years ago

Today, I upgraded my asp.net core project from 1.0.4 to 2.0 (preview 2). The project was rebuilt successfully but got this warning message: Code: CS1685 Description: The predefined type 'MarshalByRefObject' is defined in multiple assemblies in the global alias; using definition from 'System.Runtime, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' How to get rid of this one?

natemcmaster commented 7 years ago

Not enough details. Can you share a csproj file? It is most likely that you have a package reference that should be removed now that you have upgraded.

huytnd commented 7 years ago

Here is the csproj file.

<Project Sdk="Microsoft.NET.Sdk.Web">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <EnableDefaultContentItems>false</EnableDefaultContentItems>
  </PropertyGroup>
  <ItemGroup>
    <Compile Remove="wwwroot\includes\cosy\**" />
    <Compile Remove="wwwroot\includes\entypo\**" />
    <Compile Remove="wwwroot\includes\font-awesome\**" />
    <Compile Remove="wwwroot\includes\icomoon\**" />
    <Content Remove="wwwroot\includes\cosy\**" />
    <Content Remove="wwwroot\includes\entypo\**" />
    <Content Remove="wwwroot\includes\font-awesome\**" />
    <Content Remove="wwwroot\includes\icomoon\**" />
    <EmbeddedResource Remove="wwwroot\includes\cosy\**" />
    <EmbeddedResource Remove="wwwroot\includes\entypo\**" />
    <EmbeddedResource Remove="wwwroot\includes\font-awesome\**" />
    <EmbeddedResource Remove="wwwroot\includes\icomoon\**" />
    <None Remove="wwwroot\includes\cosy\**" />
    <None Remove="wwwroot\includes\entypo\**" />
    <None Remove="wwwroot\includes\font-awesome\**" />
    <None Remove="wwwroot\includes\icomoon\**" />
  </ItemGroup>
  <ItemGroup>
    <None Remove="EmailTemplates\thankyouforcontacting_inline.html" />
  </ItemGroup>
  <ItemGroup>
    <Content Include="EmailTemplates\thankyouforcontacting.html">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <Content Include="EmailTemplates\thankyouforcontacting_inline.html" />
    <Content Include="wwwroot\downloads\Outdoor_Portrait_Price_2017_en.jpg" />
    <Content Include="wwwroot\downloads\Outdoor_Portrait_Price_2017_en.pdf" />
    <Content Include="wwwroot\downloads\Outdoor_Portrait_Price_2017_vi.jpg" />
    <Content Include="wwwroot\downloads\Outdoor_Portrait_Price_2017_vi.pdf" />
    <Content Include="wwwroot\includes\font\effra-regular.eot" />
    <Content Include="wwwroot\includes\font\effra-regular.svg" />
    <Content Include="wwwroot\includes\font\effra-regular.ttf" />
    <Content Include="wwwroot\includes\font\effra-regular.woff" />
    <Content Include="wwwroot\photos\homeog.jpg" />
    <Content Include="wwwroot\sitemap.xml" />
    <Content Include="wwwroot\styles\cosy.css" />
    <Content Include="wwwroot\styles\entypo.css" />
    <Content Include="wwwroot\styles\fontawesome.css" />
    <Content Include="wwwroot\styles\fonts\effra-regular.eot" />
    <Content Include="wwwroot\styles\fonts\effra-regular.svg" />
    <Content Include="wwwroot\styles\fonts\effra-regular.ttf" />
    <Content Include="wwwroot\styles\fonts\effra-regular.woff" />
    <Content Include="wwwroot\scripts\ht_portrait.js" />
    <Content Include="wwwroot\styles\fonts\cosy.eot" />
    <Content Include="wwwroot\styles\fonts\cosy.svg" />
    <Content Include="wwwroot\styles\fonts\cosy.ttf" />
    <Content Include="wwwroot\styles\fonts\cosy.woff" />
    <Content Include="wwwroot\styles\fonts\entypo.eot" />
    <Content Include="wwwroot\styles\fonts\entypo.svg" />
    <Content Include="wwwroot\styles\fonts\entypo.ttf" />
    <Content Include="wwwroot\styles\fonts\entypo.woff" />
    <Content Include="wwwroot\styles\fonts\fontawesome-webfont.eot" />
    <Content Include="wwwroot\styles\fonts\fontawesome-webfont.svg" />
    <Content Include="wwwroot\styles\fonts\fontawesome-webfont.ttf" />
    <Content Include="wwwroot\styles\fonts\fontawesome-webfont.woff" />
    <Content Include="wwwroot\styles\fonts\FontAwesome.otf" />
    <Content Include="wwwroot\styles\fonts\icomoon.eot" />
    <Content Include="wwwroot\styles\fonts\icomoon.svg" />
    <Content Include="wwwroot\styles\fonts\icomoon.ttf" />
    <Content Include="wwwroot\styles\fonts\icomoon.woff" />
    <Content Include="wwwroot\styles\icomoon.css" />
    <Content Include="wwwroot\styles\main.css" />
  </ItemGroup>
  <ItemGroup>
    <Folder Include="Views\Error\" />
  </ItemGroup>
  <ItemGroup>
    <None Include="Resources\Views.Portfolio.Index.vi.resx" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="MailKit" Version="1.16.2" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" />
    <PackageReference Include="NWebsec.AspNetCore.Middleware" Version="1.1.0" />
    <PackageReference Include="StructureMap" Version="4.5.1" />
    <PackageReference Include="ZKWeb.System.Drawing" Version="3.0.0" />
  </ItemGroup>
  <ItemGroup>
    <EmbeddedResource Update="Resources\Views.Home.Contact.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Home.Contact.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Home.Index.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Home.Index.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Event.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Event.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Family.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Family.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Index.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Portrait.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Portrait.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Product.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Product.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Retouching.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Portfolio.Retouching.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Pricing.AoDai.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Pricing.AoDai.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Pricing.Index.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Pricing.Index.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Pricing.Portrait.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Pricing.Portrait.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Shared._Layout.en.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
    <EmbeddedResource Update="Resources\Views.Shared._Layout.vi.resx">
      <Generator>ResXFileCodeGenerator</Generator>
    </EmbeddedResource>
  </ItemGroup>
  <ItemGroup>
    <None Update="EmailTemplates\thankyouforcontacting_inline.html">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>
</Project>
huytnd commented 7 years ago

The packages I used for my project:


<PropertyGroup>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <EnableDefaultContentItems>false</EnableDefaultContentItems>
</PropertyGroup>
<ItemGroup>
    <PackageReference Include="MailKit" Version="1.16.2" />
    <PackageReference Include="Microsoft.AspNetCore" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="2.0.0-preview2-final" />
    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="2.0.0-preview2-final" />
    <PackageReference Include="NWebsec.AspNetCore.Middleware" Version="1.1.0" />
    <PackageReference Include="StructureMap" Version="4.5.1" />
    <PackageReference Include="ZKWeb.System.Drawing" Version="3.0.0" />
</ItemGroup>
`
natemcmaster commented 7 years ago

@huytnd there doesn't appear to be anything wrong with your packages. Do you have a type named MarshalByRefObject in your project? This type was added in .NET Core 2.0.

https://docs.microsoft.com/en-us/dotnet/api/system.marshalbyrefobject?view=netcore-2.0

huytnd commented 7 years ago

@natemcmaster No, I didn't use, or install this anywhere in my solution, I just upgraded all my packages from 1.0.4 to 2.0 preview2.

aspnet-hello commented 6 years ago

This issue is being closed because it has not been updated in 3 months.

We apologize if this causes any inconvenience. We ask that if you are still encountering this issue, please log a new issue with updated information and we will investigate.