Curtis
Curtis

Reputation: 1189

How do I disable suppressing a warning for one solution in a TFS build

I'm using TFS 2010 and have a TFS build setup to build our software. Everything is working just fine.

But, we are getting the following warning:

CSC: Assembly generation -- Referenced assembly 'mscorlib.dll' targets a different processor

This is because some of our code is marked as x86 only, and it is being built on an x64 platform. We cannot change the target platform because of third party software we link to. Also we are targeting the 2.0 framework, which also cannot be changed at this point.

So, I want to simply suppress this error. Seems straight forward enough. I simply edited the Build template, and added /p:NoWarn=1607. That works.

BUT!

We have ONE solution which is written in VB.net, instead of C#. This causes that one solution to fail with the following error:

vbc: warning number '1607' for the option nowarn is either not configurable or not valid

How do I disable suppressing this warning on that one solution in my TFS build? I tried to use a <customPropertiesForBuild> tag in my TFSBuild.proj file but I'm probably not using it correctly.

I know I could simply add this to my project files, but we have 37 solutions, each with multiple project files, so I really don't want to do that.

Upvotes: 1

Views: 2474

Answers (3)

Torbj&#246;rn Bergstedt
Torbj&#246;rn Bergstedt

Reputation: 3429

I don't think you can control that suppression from TFS since it is MSbuild complaining during build (and TFS simply calls MSBuild and collects the results).

There's a specific property that tells msbuild to ignore this kind of warning. Simply add the following line to your top Propertygroup in the project file for those projects generating the warning:

<PropertyGroup>
   ...
   <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
</PropertyGroup>

Upvotes: 2

Michael
Michael

Reputation: 1282

You should be able to use Properties metadata on the VB solution's SolutionToBuild item to set NoWarn to an empty value just for that solution:

<SolutionToBuild Include="$(BuildProjectFolderPath)/../../MyVbSolution.sln">
  <Targets></Targets>
  <Properties>NoWarn=;</Properties>
</SolutionToBuild>

Try that and see if your VB solution will compile without errors.

Upvotes: 1

PM_ME_YOUR_CODE
PM_ME_YOUR_CODE

Reputation: 321

You can provide a NoWarn Property to MSbuild in TFS Build. One idea also is to edit the build definition, in the "Process" Tab, explore the Advanced=>MSBuild Arguments, and then you supply this "/p:NoWarn=1607" without the qoutes. When you also queue a build, in Parameters Tab=>Advanced=>MSBuild Arguments, enter/p:NoWarn=1607.

Upvotes: 0

Related Questions