RSS

T4MVC Keeps Generating Duplicate T4MVC.cs File (T4MVC1.cs)

03 Nov

Reference: Stack Overflow

Here’s the steps I do to fix it:

  • Delete T4MVC1.cs file.
  • Unload your project.
  • Edit the .csproj file.
  • Check the following tag:
    <Compile Include="T4MVC.cs">
        <AutoGen>True</AutoGen>
        <DesignTime>True</DesignTime>
        <DependentUpon>T4MVC.tt</DependentUpon>
    </Compile>
    

    Make sure there’s only one of these and it’s T4MVC.cs. Remove T4MVC1.cs block if you have it.

  • Check the following tag:
    <None Include="T4MVC.tt">
        <Generator>TextTemplatingFileGenerator</Generator>
        <LastGenOutput>T4MVC.cs</LastGenOutput>
    </None>
    

    Make sure the is T4MVC.cs. If not, edit it to be T4MVC.cs.

  • Save the .csproj file.
  • Reload the project.
  • Rebuild
  • Make sure to check in that code so won’t cause any trouble in the future.

 

Advertisements
 
Leave a comment

Posted by on November 3, 2017 in General

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

 
%d bloggers like this: