Reputation: 956
In Visual Studio (I'm using 2013), I want to treat certain warnings as errors, but it doesn't work. Specifically, after I try to compile, I looked at the output window, and, among other things, I see that it says:
C:\Program Files (x86)\MSBuild\12.0\bin\Microsoft.Common.CurrentVersion.targets(1697,5): warning MSB3245: Could not resolve this reference. Could not locate the assembly "nunit.core". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
So I'm thinking, OK, let's treat that as an error, so that I'll see it before I try to build. So in the project properties > Build tab > Treat warnings as errors > specific warnings > I put in MSB3245. Then I get another warning that says:
'MSB3245' is not a valid warning number
Update:
I decided that I also want to see when I'm "treating warning as errors" in a way that will invoke this warning, so I decided to treat this warning itself (which happens to be CS1691) as a warning. Then, this is what I get in the output window:
CSC : warning CS1691: 'CS1691' is not a valid warning number
That doesn't even make sense! And it's a CS error, not an MSB error, so I'm not sure why it wouldn't work.
Why is this happening?
Thanks,
Upvotes: 2
Views: 617
Reputation: 41
You should only specify the number, not the 'CS' or 'MSB' part, so '3245' instead of 'MSB3245'. This worked for me in the past, and it is actually what the error message is trying to tell you, although I must say it's not that clear.
I'm not sure if this might result in mixed up error codes, as there might be a MSB3245 and a CS3245, but you could try that out.
Upvotes: 0