Umbraco & TFS - Including hidden files

2019-06-02 15:15发布

问题:

I have an umbraco 6.* site set up in VS2012 and am using TFS for source control.

If I add templates, media items etc to the umbraco site through the umbraco backend the new files are not automatically included in the solution and I have to manually include the files so that they can be checked in to source control.

This can become quickly unmanageable when installing packages etc. or anything that creates a lot of files throughout different folder locations.

Does anyone have a solution to guarantee all files are checked into source control?

Changing source control is not an option.

Thanks

回答1:

I came across this article which explains how to 'blanket' include files or folders in a .csproj file. In a nutshell you can add the following references:

<Content Include="Path\To\Folder\**" />
<Content Include="Path\To\Folder\*.*" />
<Content Include="Path\To\Folder\*.jpg" >

So in the case of Umbraco you will first need to exclude the following folders from the project:

  • /umbraco
  • /umbraco_client
  • /media
  • /masterpages
  • /views
  • /macroscripts
  • /xslt

then open up the .csproj file in a test editor and add:

<Content Include="umbraco\**" />
<Content Include="umbraco_client\**" />
<Content Include="media\**" />
<Content Include="masterpages\**" />
<Content Include="views\**" />
<Content Include="macroscripts\**" />
<Content Include="xslt\**" />

Save it, and then in VS reload your project.