3

I tried escaping the semicolons like this in the parameters:

/fileLoggerParameters:LogFile=msbuild.log;Append;PerformanceSummary;DisabledWarnings=1%3B2%3B3%3B40003%3B40055%3B42020%3B42021%3B42022%3B42025%3B42104%3BBC40003%3BBC40055%3BBC42020%3BBC42021%3BBC42022%3BBC42025%3BBC42104;WarningLevel=0;VbcVerbosity=Quiet /property:DisabledWarnings=1%3B2%3B3%3B40003%3B40055%3B42020%3B42021%3B42022%3B42025%3B42104%3BBC40003%3BBC40055%3BBC42020%3BBC42021%3BBC42022%3BBC42025%3BBC42104;WarningLevel=0;VbcVerbosity=Quiet

But in my log it still shows them as escaped:

   Task "MSBuild"
     Global Properties:
       Configuration=Release
       DebugSymbols=false
       DisabledWarnings=1%3b2%3b3%3b40003%3b40055%3b42020%3b42021%3b42022%3b42025%3b42104%3bBC40003%3bBC40055%3bBC42020%3bBC42021%3bBC42022%3bBC42025%3bBC42104
       Optimize=true
       WarningLevel=0
       VbcVerbosity=Quiet

I'm trying to suppress warnings like this (from aspnet_compiler.exe which I assume is using vbc.exe under the hood) that I don't care about:

  • warning BC42020: Variable declaration without an 'As' clause; type of Object assumed.
  • warning BC42021: Function without an 'As' clause; return type of Object assumed.
  • warning BC42022: Property without an 'As' clause; type of Object assumed.
  • etc.

Update: Now I'm not sure if escaping with quotes worked or not. I still get the warnings and I've tried NoWarn, DisabledWarnings, /verbosity:quiet, WarningLevel=0 and VbcVerbosity=Quiet and nothing seems to suppress them.

Update 2: Here's the full build command:

C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe /nologo /consoleloggerparameters:PerformanceSummary /verbosity:quiet /fileLogger /fileLoggerParameters:LogFile=msbuild.log;Append;PerformanceSummary;VbcVerbosity=Quiet;DisabledWarnings="40003;40055;42020;42021;42022;42025;42104;BC40003;BC40055;BC42020;BC42021;BC42022;BC42025;BC42104";WarningLevel=0;NoWarn="40003;40055;42020;42021;42022;42025;42104;BC40003;BC40055;BC42020;BC42021;BC42022;BC42025;BC42104" /target:JustWebSite /maxcpucount:3 "Build.proj"

And Build.proj:

<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="JustWebSite" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">

    <UsingTask TaskName="Microsoft.Build.Tasks.CreateTemporaryVCProject" AssemblyName="Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    <UsingTask TaskName="Microsoft.Build.Tasks.ResolveVCProjectOutput" AssemblyName="Microsoft.Build.Tasks.v3.5, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />

    <PropertyGroup>
        <SolutionName>WebSiteX</SolutionName>
        <ProjectFolder>D:\Projects\$(SolutionName)</ProjectFolder>
        <VirtualPath>\</VirtualPath>

        <AspNetConfiguration>Release</AspNetConfiguration>
        <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
        <AspNetVirtualPath>$(VirtualPath)</AspNetVirtualPath>
        <AspNetPhysicalPath>$(ProjectFolder)\$(SolutionName)\</AspNetPhysicalPath>
        <AspNetTargetPath>PrecompiledWeb\$(SolutionName)\</AspNetTargetPath>
        <AspNetForce>true</AspNetForce>
        <AspNetUpdateable>true</AspNetUpdateable>
        <AspNetDebug>False</AspNetDebug>
        <AspNetKeyFile></AspNetKeyFile>
        <AspNetKeyContainer></AspNetKeyContainer>
        <AspNetDelaySign></AspNetDelaySign>
        <AspNetAPTCA></AspNetAPTCA>
        <AspNetFixedNames>false</AspNetFixedNames>
        <AspNetTargetPath Condition=" '$(OutDir)' != '' ">$(OutDir)_PublishedWebsites\$(SolutionName)\</AspNetTargetPath>
    </PropertyGroup>


    <Target Name="GetFrameworkPathAndRedistList">
        <GetFrameworkPath>
            <Output TaskParameter="Path" ItemName="_CombinedTargetFrameworkDirectoriesItem" Condition="'$(MSBuildToolsVersion)' == '2.0'" />
            <Output TaskParameter="FrameworkVersion35Path" ItemName="_CombinedTargetFrameworkDirectoriesItem" Condition=" '$(TargetFrameworkVersion)' == 'v3.5' and '$(MSBuildToolsVersion)' != '2.0'" />
            <Output TaskParameter="FrameworkVersion30Path" ItemName="_CombinedTargetFrameworkDirectoriesItem" Condition=" ('$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5') and '$(MSBuildToolsVersion)' != '2.0'" />
            <Output TaskParameter="FrameworkVersion20Path" ItemName="_CombinedTargetFrameworkDirectoriesItem" Condition=" ('$(TargetFrameworkVersion)' == 'v2.0' or '$(TargetFrameworkVersion)' == 'v3.0' or '$(TargetFrameworkVersion)' == 'v3.5') and '$(MSBuildToolsVersion)' != '2.0'" />
        </GetFrameworkPath>
        <CreateItem Include="@(_CombinedTargetFrameworkDirectoriesItem->'%(Identity)\RedistList\*.xml')">
            <Output TaskParameter="Include" ItemName="InstalledAssemblyTables" />
        </CreateItem>
    </Target>

    <Target Name="JustWebSite" DependsOnTargets="GetFrameworkPathAndRedistList">
        <Message Text="Just building website..." />

        <CombinePath BasePath="$(AspNetPhysicalPath)" Paths="@(References_ReferenceRelPath)">
            <Output TaskParameter="CombinedPaths" ItemName="References" />
        </CombinePath>

        <Copy SourceFiles="@(References->'%(FullPath)')" DestinationFolder="$(AspNetPhysicalPath)\Bin\" Condition="!Exists('%(References.Identity)')" ContinueOnError="true" SkipUnchangedFiles="true" />

        <ResolveAssemblyReference Assemblies="@(References->'%(FullPath)')" TargetFrameworkDirectories="@(_CombinedTargetFrameworkDirectoriesItem)" InstalledAssemblyTables="@(InstalledAssemblyTables)" SearchPaths="{RawFileName};{TargetFrameworkDirectory};{GAC}" FindDependencies="true" FindSatellites="true" FindSerializationAssemblies="true" FindRelatedFiles="true" Condition="Exists('%(References.Identity)')">
            <Output TaskParameter="CopyLocalFiles" ItemName="References_CopyLocalFiles" />
        </ResolveAssemblyReference>

        <Copy SourceFiles="@(References_CopyLocalFiles)" DestinationFiles="@(References_CopyLocalFiles->'$(AspNetPhysicalPath)\Bin\%(DestinationSubDirectory)%(Filename)%(Extension)')" Condition="(false) or ('$(AspNetConfiguration)' == 'Debug') or ('$(AspNetConfiguration)' == 'Release')" SkipUnchangedFiles="true" />

        <AspNetCompiler VirtualPath="$(AspNetVirtualPath)" PhysicalPath="$(AspNetPhysicalPath)" TargetPath="$(AspNetTargetPath)" Force="$(AspNetForce)" Updateable="$(AspNetUpdateable)" Debug="$(AspNetDebug)" KeyFile="$(AspNetKeyFile)" KeyContainer="$(AspNetKeyContainer)" DelaySign="$(AspNetDelaySign)" AllowPartiallyTrustedCallers="$(AspNetAPTCA)" FixedNames="$(AspNetFixedNames)" Condition="(false) or ('$(AspNetConfiguration)' == 'Debug') or ('$(AspNetConfiguration)' == 'Release')" />

    </Target>
</Project>
travis
  • 35,751
  • 21
  • 71
  • 94
  • Have you tried getting the warnings to be ignored when compiling with Visual Studio and reviewing the command line it shows? (I'm not at my VS computer to try it myself.) – Mark Hurd Sep 24 '12 at 14:39
  • It's been awhile, Mark, so I'll take a look, but I'm pretty sure that Visual Studio's build doesn't have the same command-line settings as msbuild. – travis Sep 24 '12 at 15:21

1 Answers1

2

Populate the NoWarn property as follows:

msbuild your.vbproj /p:NoWarn="40003,40055,42020,42021,42022,42025,42104,40003,40055"
KMoraz
  • 14,004
  • 3
  • 49
  • 82
  • I didn't think of using quotes to escape them, thanks, I'll try that when I get back into the office. – travis Mar 10 '12 at 18:28
  • It looks like it accepted the parameters, but then it still showed the warnings. – travis Mar 20 '12 at 02:32
  • No escaping is required. how do you run the build? – KMoraz Mar 20 '12 at 08:57
  • I've updated the question with the full build command. The only way that I can get the warnings to not be shown is if I pass `/noconsolelogger` into the command line, but that hides everything. And the warnings are always output into the log file. (I tried using both commas and semicolons) – travis Mar 20 '12 at 14:41
  • You're omitting the `/p:` or `/property:` switch before the `NoWarn` – KMoraz Mar 21 '12 at 07:15
  • I've tried both `/property:NoWarn="40003;40055;42020;42021;42022;42025;42104;BC40003;BC40055;BC42020;BC42021;BC42022;BC42025;BC42104"` and `/property:NoWarn="40003,40055,42020,42021,42022,42025,42104,BC40003,BC40055,BC42020,BC42021,BC42022,BC42025,BC42104"` and neither works. – travis Mar 21 '12 at 16:01