B Singh
B Singh

Reputation: 133

Visual Studio keeps showing the bin folder in my project

I am using Visual Studio 2019 for my C# based solution and I use Git for source control. Yesterday I added two new .NET 2.0 standard SDK projects to my solution and for some reason VS keeps showing the bin folder in the solution explorer for these projects. They have a red icon on them. Does anyone know what that means and how can I get rid of them? enter image description here

Upvotes: 5

Views: 1562

Answers (2)

Pharaz Fadaei
Pharaz Fadaei

Reputation: 1827

You can use TfmSpecificPackageFile instead of <None Include.... This is what the analyzer template of Visual Studio generates and by using it, the bin folder won't be shown in the solution explorer.

<PropertyGroup>
  <TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);_AddAnalyzersToOutput</TargetsForTfmSpecificContentInPackage>
</PropertyGroup>

<Target Name="_AddAnalyzersToOutput">
  <ItemGroup>
    <TfmSpecificPackageFile Include="$(OutputPath)\$(AssemblyName).dll" PackagePath="analyzers/dotnet/cs" />
  </ItemGroup>
</Target>

Upvotes: 2

B Singh
B Singh

Reputation: 133

I realized the cause of this behavior. It is because I am excluding the output of the project compilation to be included in the nuget package because these are analyzer projects.

<None Include="$(OutputPath)\$(AssemblyName).dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />

Upvotes: 4

Related Questions