views:

26

answers:

1

I have some project's with various compile switches, so depending on how they are built do not need a referenced dll , so I get a warning that it does not exist.

I would like to suppress this warning so we are warning free. How do I do this on the project on VS2010, what number to I put in the suppress warning box on the prject page ?

A: 

It sounds like an MSBuild warning, not a C# compiler warning (by virtue of the 'MSB') which I'm not sure is supressible. But you can just make that reference conditional, probably, something like

<Reference Condition=" $(DefineConstants.Contains('THAT_ONE_SWITCH') " ... />

though I haven't tried the exact syntax offhand.

Brian
Thanks were not using MSbuild just vs2010, where would the above line go ?
Kaya
You are using MSBuild (this is how VS builds), it goes in the .csproj file. Right click the project, click 'unload project', then right click and 'edit foo.csproj'. But if you have never done this before, you should maybe get advice from someone who has bothered to test this, which is not me :)
Brian