Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managed target code requires a '\clr' option : Error

When I try to batch build my project, I encounter this error while I have enabled the clr runtime support.

My project can run with no problem and I only receive this error when I try to make a batch build.

I have made a lot of searched in google but most results are about enabling the clr option. I'd like to know how I can fix this problem.

like image 888
No Name Jackson Avatar asked Apr 19 '13 07:04

No Name Jackson


1 Answers

This is the kind of problem you'll run into when you make project setting changes while you are debugging your project. Settings are stored per configuration. A common mistake is to make the change for the Debug configuration but forgetting to make the same change for the Release configuration. Kaboom when you then try to get the Release configuration built, as would happen when you use Batch Build.

Go slower. Project + Properties, Configuration Properties, General. Note the combobox labeled "Configuration" in the upper left corner. It probably now says "Active (Debug)". Change it to "Release". And note how the "Common Language Runtime support" setting changes as you flip back and forth. Make them the same, /clr. Use Build + Configuration Manager to make the Release build the default configuration and use Build + Build to build it. Test it.

There might be other settings you've changed that need to be corrected for the Release build as well.

like image 182
Hans Passant Avatar answered Nov 14 '22 21:11

Hans Passant