aybe
aybe

Reputation: 16662

Why is Visual Studio creating .meta files even outside Assets folder?

I have the following project setup:

Now, whenever adding a class to that Test project, I found that a .meta file is being added as well.

This doesn't seem correct as .meta files are supposedly only for files inside Assets.

Using Process Monitor I discovered that indeed it is devenv.exe that is creating these .meta files.

Quick-fix:

Using ignores Visual Studio and Unity ignores, these .meta files are not committed to the repository,

And adding this to the csproj will hide them:

  <ItemGroup>
    <None Update="**/*.meta" Visible="false" />
  </ItemGroup>

But in reality, this only hides the problem ...

And unfortunately, this approach won't work in Directory.Build.props, forcing one to manually add former code block to each of these 'external' projects.

Question:

Why are .meta files also created outside Assets and how to turn that off?

Upvotes: 2

Views: 468

Answers (1)

aybe
aybe

Reputation: 16662

For now, putting this in Directory.Build.props at root effectively removes the need to manually update each project:

<Project>
    <PropertyGroup>
        <DefaultItemExcludes>$(DefaultItemExcludes);**\*.meta</DefaultItemExcludes>
    </PropertyGroup>
</Project>

But this only hides the problem instead of fixing it...

Update

The problem comes from Resharper and has been fixed:

Avoid creating meta files outside Assets and Packages (#1489)

Upvotes: 2

Related Questions