Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How ignore file by extension in visual studio code #2328

Closed
surendrakandira93 opened this issue Mar 25, 2017 · 1 comment
Closed

How ignore file by extension in visual studio code #2328

surendrakandira93 opened this issue Mar 25, 2017 · 1 comment

Comments

@surendrakandira93
Copy link

How to ignore .csproj file in visual studio code
I have got error
Build FAILED.

obj\Debug\netstandard1.6\InvoiceService.Common.AssemblyInfo.cs(1,1): error SA1412: Store files as UTF-8 with byte order mark [E:\xyz\InvoiceService\src\InvoiceService.Common\InvoiceService.Common.csproj]
C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'E:\xyz\InvoiceService\src\InvoiceService.Common\InvoiceService.Common.csproj'. This can indicate a missing project reference. [E:\xyz\InvoiceService\src\InvoiceService.Entity\InvoiceService.Entity.csproj]
C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'E:\xyz\InvoiceService\src\InvoiceService.Common\InvoiceService.Common.csproj'. This can indicate a missing project reference. [E:\xyz\InvoiceService\src\InvoiceService.DataAccess\InvoiceService.DataAccess.csproj]
C:\Program Files\dotnet\sdk\1.0.1\Sdks\Microsoft.NET.Sdk\build\Microsoft.NET.Sdk.targets(92,5): error : Cannot find project info for 'E:\xyz\InvoiceService\src\InvoiceService.Common\InvoiceService.Common.csproj'. This can indicate a missing project reference. [E:\xyz\InvoiceService\src\InvoiceService.Business\InvoiceService.Business.csproj]

0 Warning(s)
4 Error(s)

My CSPROJ file


<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard1.6</TargetFramework>
    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
    <GenerateDocumentationFile>true</GenerateDocumentationFile>
    <AssemblyName>InvoiceService.Common</AssemblyName>
    <PackageId>InvoiceService.Common</PackageId>
    <NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
    <PackageTargetFallback>$(PackageTargetFallback);dnxcore50</PackageTargetFallback>
    <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
    <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
    <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
    <CodeAnalysisRuleSet>../ProjSettings/xyz-RuleSet.ruleset</CodeAnalysisRuleSet>	
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.0.3" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="1.0.2" />
    <PackageReference Include="Newtonsoft.Json" Version="9.0.1" />    
    <PackageReference Include="StyleCop.Analyzers" Version="1.0.0" />	 
    <AdditionalFiles Include="../ProjSettings/stylecop.json" />
  </ItemGroup>

</Project>
@bjornhellander
Copy link
Contributor

First of all, the diagnostic is reported for obj\Debug\netstandard1.6\InvoiceService.Common.AssemblyInfo.cs, not for the project file, so being able to ignore files based on extension would not help you.

There is currently no way of having StyleCop Analyzers ignore specific files, but there is a Roslyn issue about adding support for this generically for all analyzers (dotnet/roslyn#3705).

It looks like the file in question is automatically generated during build (functionality possibly added in this issue: dotnet/sdk#57). The compiler itself is supposed to automatically skip analysis of generated files, so I suggest you report the problem in https://github.com/dotnet/sdk, for example suggesting to add the BOM to the generated file or making sure the file is generated in a way so that the compiler understands that it is generated.

Another way forward could be to manually write the AssemblyInfo file, if it is possible to turn off the auto generation. That way, you would have complete control over it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants