5

I use VS 2015 U1. I use an external library with a strange versioning - 1.0.4056.40164.

I added a .Fakes file for this library. When fakes assembly is built, I get the following warning:

C:\Somewhere.Test\f.cs(21,58): warning CS7035: The specified version string does not conform to the recommended format - major.minor.build.revision [C:\Somewhere.Test\obj\Debug\Fakes\rs\f.csproj]

I have specified in my .Fakes file:

 <Compilation>
    <Property Name="NoWarn">CS7035,7035</Property>
    <Property Name="DisabledWarnings">7035;1607</Property>
  </Compilation>

with no luck.

I also added this to my Somewhere.Test.csproj:

  <NoWarn>CS7035;7035</NoWarn>

Since I do not control this third party library, it makes it fairly frustrating to watch this warning in an otherwise clean solution.

How can I suppress it just for this fakes assembly?

zaitsman
  • 8,984
  • 6
  • 47
  • 79

3 Answers3

7

I've successfully suppressed this warning with

<NoWarn>7035</NoWarn>

but in my project file. I needed to add it in all possible configuration and platform choices. I have two, so I ended up with:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  <DebugSymbols>true</DebugSymbols>
  <DebugType>full</DebugType>
  <Optimize>false</Optimize>
  <OutputPath>bin\</OutputPath>
  <DefineConstants>DEBUG;TRACE</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
  <NoWarn>7035</NoWarn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  <DebugType>pdbonly</DebugType>
  <Optimize>true</Optimize>
  <OutputPath>bin\</OutputPath>
  <DefineConstants>TRACE</DefineConstants>
  <ErrorReport>prompt</ErrorReport>
  <WarningLevel>4</WarningLevel>
  <NoWarn>7035</NoWarn>
</PropertyGroup>

Hope this helps

Stephen Bethke
  • 111
  • 1
  • 7
  • Sorry, no go. I added this to all my configurations and same warning. Are you using Microsoft Fakes though? because for me the warning does not come from my project, it comes from fakes. – zaitsman Jun 03 '16 at 15:01
  • You can just add a new PropertyGroup with this suppression: 7035 . It still won't work for fakes though as it's generating a new assembly. – NStuke Oct 09 '16 at 06:52
2

In VS2017 I have managed to remove this nasty warning by adding #pragma warning disable directly in AssemblyInfo.cs file:

#pragma warning disable CS7035 // The specified version string does not conform to the recommended format - major.minor.build.revision 
[assembly: AssemblyFileVersion("1.0.*")]
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
1

In my case it was removing of <Deterministic>true</Deterministic> from csproj.

gurbi
  • 163
  • 2
  • 14
  • Which csproj? The one from test project? – zaitsman Oct 10 '18 at 12:52
  • Well, in my case it was in my production code. It always complained, that version does not conform (even if it did!) and it was solved only by removing those settings from csproj. (I compared with solution where I knew it compiled Ok and this was only significant difference) – gurbi Oct 10 '18 at 12:59
  • the question is specifically about Microsoft Fakes. I do not control the version of the external dependency. – zaitsman Oct 10 '18 at 12:59