Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Cannot define a class or member that utilizes 'dynamic' compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' not found

$
0
0

Hello everyone,

I'm currently facing an issue with ASP.NET Core targeting the framework 4.6.1.

Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?+
    public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
Predefined type 'System.Boolean' is not defined or imported+
    public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
    public class _Views_Home_Index_cshtml : Microsoft.AspNetCore.Mvc.Razor.RazorPage<dynamic>
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
Predefined type 'System.Object' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
Predefined type 'System.Void' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; }
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
Predefined type 'System.Object' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
Predefined type 'System.Void' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.IUrlHelper Url { get; private set; }
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
Predefined type 'System.Object' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
Predefined type 'System.Void' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.IViewComponentHelper Component { get; private set; }
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
Predefined type 'System.Object' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
Predefined type 'System.Void' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.Rendering.IJsonHelper Json { get; private set; }
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
Predefined type 'System.Object' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
Predefined type 'System.Object' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
Cannot define a class or member that utilizes 'dynamic' because the compiler required type 'System.Runtime.CompilerServices.DynamicAttribute' cannot be found. Are you missing a reference?+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
Predefined type 'System.Boolean' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
Predefined type 'System.Void' is not defined or imported+
        public Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper<dynamic> Html { get; private set; }
The return type of an async method must be void, Task or Task<T>+
        public override async Task ExecuteAsync()
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public override async Task ExecuteAsync()
Predefined type 'System.Object' is not defined or imported+
        public override async Task ExecuteAsync()
The type or namespace name 'Task' could not be found (are you missing a using directive or an assembly reference?)+
        public override async Task ExecuteAsync()
'_Views_Home_Index_cshtml.ExecuteAsync()': return type must be 'Task' to match overridden member 'RazorPage.ExecuteAsync()'+
        public override async Task ExecuteAsync()
The type 'Task' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        public override async Task ExecuteAsync()
Predefined type 'System.Void' is not defined or imported+
        public _Views_Home_Index_cshtml()
        {
        }
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Object' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Void' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Object' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Void' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Object' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Void' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Object' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Void' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Object' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
The type 'Attribute' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Void' is not defined or imported+
        [Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute]
Predefined type 'System.Void' is not defined or imported+
        public _Views_Home_Index_cshtml()
'_Views_Home_Index_cshtml.ExecuteAsync()': not all code paths return a value+
        public override async Task ExecuteAsync()

Here the references:

<ItemGroup><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.0.2" /><PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="1.1.1" /><PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.0.3" /><PackageReference Include="Microsoft.AspNetCore.Razor" Version="1.1.0" /><PackageReference Include="Microsoft.AspNetCore.Razor.Runtime" Version="1.1.0" /><PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="1.0.1" /><PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.1.1" /><PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="1.0.2" /><PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="1.0.3" /><PackageReference Include="Microsoft.AspNetCore.SpaServices" Version="1.1.1" /><PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="1.0.2" /><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.0.3" /><PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.Design" Version="1.0.3"><PrivateAssets>All</PrivateAssets></PackageReference><PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="1.0.0"><PrivateAssets>All</PrivateAssets></PackageReference><PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="1.1.1" /><PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.0.2" /><PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="1.0.2" /><PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" /><PackageReference Include="Microsoft.Extensions.Logging.Console" Version="1.0.2" /><PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="1.0.2" /><PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.0.2" /><PackageReference Include="Microsoft.VisualStudio.Web.BrowserLink" Version="1.0.1" /><PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="1.0.0"><PrivateAssets>All</PrivateAssets></PackageReference><PackageReference Include="NAudio" Version="1.8.0" /><PackageReference Include="OctoPack" Version="3.6.1" /></ItemGroup><ItemGroup Condition=" '$(TargetFramework)' == 'net461' "><Reference Include="System" /><Reference Include="Microsoft.CSharp" /></ItemGroup><Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"><!--<Exec Command="bower install" />--><Exec Command="dotnet bundle" /></Target><ItemGroup><DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.301" /><DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" /><DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" /><DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" /><DotNetCliToolReference Include="Microsoft.DotNet.Watcher.Tools" Version="1.0.0" /></ItemGroup>

The project is on bitbucket and when my teammate pull the project he doesn't facing this issue.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>