1

I'm trying to enable CodeAnalysis on TeamCity build.

I have been able to define my own RuleSet, enable it at all configurations etc.

Unfortunately TeamCity build is giving me following error:

.NETFramework,Version=v4.6.AssemblyAttributes.cs(2, 1): error CS8019: Unnecessary using directive.

Problem is that error never shows on local VS build.

I went through couple of other answers, and found possible solution here: CS8019 Error on Assemblyinfo on temp file MSBuild Server

That's part of my Build.proj file:

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

      <PropertyGroup>
        <MSBuildCommunityTasksPath>$(MSBuildProjectDirectory)\.build</MSBuildCommunityTasksPath>
        <MSBuildSDKToolsPath>"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools"</MSBuildSDKToolsPath>
        <TargetFrameworkMonikerAssemblyAttributesFileClean>False</TargetFrameworkMonikerAssemblyAttributesFileClean>
        <TargetFrameworkMonikerAssemblyAttributesPath>$(MSBuildThisFileDirectory)SharedAssemblyAttributes.cs</TargetFrameworkMonikerAssemblyAttributesPath>
      </PropertyGroup>

...

<Target Name="Compile">
    <MSBuild Projects="@(Solution)" Properties="Configuration=$(Configuration)" ContinueOnError="false"/>
  </Target>

I also tried that approach:

<PropertyGroup>
    <MSBuildCommunityTasksPath>$(MSBuildProjectDirectory)\.build</MSBuildCommunityTasksPath>
    <MSBuildSDKToolsPath>"C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools"</MSBuildSDKToolsPath>
    <TargetFrameworkMonikerAssemblyAttributesPath>$([System.IO.Path]::Combine('$(IntermediateOutputPath)','$(TargetFrameworkMoniker).AssemblyAttributes$(DefaultLanguageSourceExtension)'))</TargetFrameworkMonikerAssemblyAttributesPath>
  </PropertyGroup>

Did I added information about TargetFrameworkMonikerAssemblyAttributes in right place?

Community
  • 1
  • 1
madoxdev
  • 3,770
  • 1
  • 24
  • 39

0 Answers0