57431

Why is my project building with an unknown Attribute?

Question:

So, my code seems to be compiling without errors when it should not compile.

Here, this project has no NuGet packages for AspNetCore.Mvc and hence this should not compile but still it does.

Notice, the ModleBinder is in white color which means it does not recognize this type - still it is compiling. In another console app of the same VS this behaves fine.

I am using VS 2017 15.4

<a href="https://i.stack.imgur.com/e2PyR.png" rel="nofollow"><img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/e2PyR.png" data-original="https://i.stack.imgur.com/e2PyR.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" /></a>

Some of the things I have already done

<ul><li>restarted VS many times</li> <li>Deleted the .vs folder</li> <li>Cleaned and Rebuilt the solution </li> <li>deleted vs folder and restarted the computer</li> </ul>

Answer1:

So, I have found the root cause.

The root cause of the mentioned issue is this line in the .csproj file

<PropertyGroup> <EnableDefaultCompileItems>false</EnableDefaultCompileItems> </PropertyGroup>

I had to add this line to avoid <a href="https://stackoverflow.com/questions/43325916/duplicate-content-items-were-included-the-net-sdk-includes-content-items-f" rel="nofollow">another error</a>. But it seems this was not the right thing to solve this problem. Instead <a href="http://jameschambers.com/2017/11/duplicate-compile-items-included/" rel="nofollow">this seems to be right fix</a> for my original problem.

Recommend

  • dump-autoload command from php
  • Overloading rules for inheritance in C++
  • Google Cloud Vision TEXT_DETECTION only on digits
  • Hand written character recognition using neural network
  • Google cloud speech syncrecognize “INVALID_ARGUMENT”
  • Visual Studio 2008 resource editor is annoying with PNG's
  • How to prevent Excel from handling strings containing a colon as formulas
  • Why are XML namespaces HTTP addresses?
  • jQuery not triggering on appended item
  • How to call a dot net asssembly / namespace in XSLT
  • Projecting domain model child count onto view model without extra queries
  • Clipboard.ContainsData and Clipboard.GetData
  • CRLF in VBScript
  • Linq: method cannot be translated into a store expression
  • SSIS ragged file not recognized CRLF
  • Spring Integration debounce/deduplicate
  • ZXING intent request code (identifying my intent)
  • Send multimedia commands
  • abstracting over a collection
  • Invalid object name 'dbo.Item'
  • req.body is undefined - nodejs
  • How reduce the height of an mschart by breaking up the y-axis
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • Does CUDA 5 support STL or THRUST inside the device code?
  • How to apply VCL Styles to DLL-based forms in Inno Setup?
  • Can a Chrome extension content script make an jQuery AJAX request for an html file that is itself a
  • Symfony2: How to get request parameter
  • When should I choose bucket sort over other sorting algorithms?
  • Upload files with Ajax and Jquery
  • How do you troubleshoot character encoding problems?
  • Akka Routing: Reply's send to router ends up as dead letters
  • How to pass list parameters for each object using Spring MVC?
  • Is there a mandatory requirement to switch app.yaml?
  • Proper way to use connect-multiparty with express.js?
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • Understanding cpu registers
  • How do I configure my settings file to work with unit tests?
  • Android Google Maps API OnLocationChanged only called once
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Binding checkboxes to object values in AngularJs