How to ignore optional parameter error on MSBuild 3.5

I am using Visual Studio 2010.

I downloaded an updated class (e.g. updatedClass.cs) that has a method with an additional parameter, for example:

public void DoThis(bool aValue = false) {...}

Using Visual Studio 2010, I can compile it. But I can not do this with MSBuild:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe /t:Rebuild /clp:ErrorsOnly D:\folder\mySolution.sln
ln
Microsoft (R) Build Engine Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5448]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

UpdatedClass.cs(29,94): error CS0241: Default parameter specifiers are not permitted

Well, optional parameters are not allowed using this compiler. Can I add an extra argument to this MSBuild command to ignore such an error?

Or do I need to compile a project using C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\MSBuild.exe? Is this safe for asp.net projects?

+5
source share
1 answer

# 4, 4.0. , .Net 4.0 , . - , , - :

public void DoThis() {DoThis(false);}
public void DoThis(bool aValue) {...}
+4

All Articles