I'm transpiling TypeScript files from my web project into wwwroot as part of my gulp build. I want Visual Studio Team Services to ignore the output js files in wwwroot, but it constantly detects them as added files and I have to undo. The server is #visualstudio.com. In my wwwroot folder I have a .tfignore file with the following text, which should ignore all files in these folders:
lib\*.*
app\*.*
I have also attempted to add a .tfignore file at the higher level (project root), just to see if I could get it to ignore js files:
wwwroot\app\**\*.js
I've also added the following lines to my .xproj, which seems to have no effect.
<ItemGroup>
<DnxInvisibleFolder Include="wwwroot\app\" />
<DnxInvisibleFolder Include="wwwroot\lib\" />
</ItemGroup>
How do I ignore these folders/files? This is a VS2015 / Asp.net 5 project.
This is a known issue with tfignore file for ASP.NET5 project. Refer to this issue on GitHub for details: https://github.com/aspnet/Tooling/issues/18
Related
I have seen few web posts and solutions but do not seem to work.
Am i missing the obvious?
this is what I have
At Solution level and not where the package resides
I have a folder like the pic below
.tfignore contains the following
# Ignore NuGet Packages
*.nupkg
# Ignore the NuGet packages folder in the root of the repository. If needed, prefix 'packages'
# with additional folder names if it's not in the same folder as .tfignore.
packages
# Omit temporary files
project.lock.json
project.assets.json
*.nuget.props
nuget.config.xml contains
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
When I try to checkin items in visual studio 2017 it still shows all the packages.
Can somebody help with what I am doing wrong?
thanks
According to your screenshot, you are not using the correctly .tfignore file. This file does not have any suffix. One way to create it, suggest you to rename a new.txt file with "tfignore." It will auto change to right .tfignore file.
You can also use the auto automatically generated .tfignore file, follow below steps in my answer here.
More detail info about the .tfignore file please refer this tutorial.
Note: This .tfignore file will not affect with those files already in source control. You need to remove them from source control first. Also make sure your .tfignore files have checked in source control.
In my opinion .tfignore should be located in solution folder directly and the file name is .tfignore and not .tfignore.txt
The nuget config name is NuGet.config and not nuget.config.xml
If packages are installed before .tfignore created, then you have may be to "undo" package folder first in Source Control explorer.
Personally I would ignore the entire nuget packages folder with exception of targets
I've been pulling my hair out on this for a while now. I'm trying to implement a continuous integration and deployment pipeline using TeamCity and Octopus Deploy. I am 99% there, except for one problem. I am using the standard msbuild runner of teamcity, configured to use the version 12 of msbuild.
I need to include the web.config transforms in the published output so they can be packaged into a nuget package for octopus deploy. I do not want the transforms to be applied by msbuild.
I am not using Octopack to create packages. I'm using the built-in teamcity nuget packager. So I'm publishing the website to a filesystem folder and then creating the package from the files in this folder. However, no matter what I do I cannot get msbuild to include the web.config transform files in the publish (I am using Octopus Deploy to perform the transforms, so I don't want msbuild to perform them).
I have verified that all the transform files (Web.Release.config, etc..) are marked as "Content". I have NOT marked them to copy always, because doing this copies them to the bin folder, not the root folder where they belong.
I have removed the /p:Configuration= property from the msbuild command line as I've read that is required for transforms to be applied. my parameters to msbuild look like this:
/p:DeployOnBuild=true /p:PublishProfile=Deployment
There is nothing in the publish profile that seems to relate to transforms. The publish profile contains the filesystem location to publish to.
Any suggestions here?
Note: I've given up and found a different solution, but I'm leaving this open in case anyone has any input.
You could create a custom .nuspec file and reference the files that you want to include from there.
My suggestion would be to have the .nuspec file in the same directory as the web.config / web.release.config files, and make the paths relative from there.
So if you publish to a directory called /output you could use rules like this
<files>
<file src="*.config" target="\" />
<file src="publish\*.*" target="\" />
</files>
So nuget pack nuspecPath would become the way to pack the project
NuSpec Reference
Hope this helps
I cannot make it, so that the Publish from visual studio doesnt delete the App_Data folder on the server website. But i would also like it to keep deleting all files (except that folder) to keep the dir "clean".
I have tried this in csproj, .pubxml. And alterations of it (theres one not OnBeforePackageUsingManifest, but iis something)
<PropertyGroup>
<OnBeforePackageUsingManifest>AddCustomSkipRules</OnBeforePackageUsingManifest>
</PropertyGroup>
<Target Name="AddCustomSkipRules">
<ItemGroup>
<MsDeploySkipRules Include="SkipDeleteAppData">
<SkipAction>Delete</SkipAction>
<ObjectName>filePath</ObjectName>
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
<MsDeploySkipRules Include="SkipDeleteAppData">
<SkipAction>Delete</SkipAction>
<ObjectName>dirPath</ObjectName>
<AbsolutePath>$(_Escaped_PackageTempDir)\\App_Data\\.*</AbsolutePath>
<XPath>
</XPath>
</MsDeploySkipRules>
</ItemGroup>
</Target>
I even get if i use "SkipAction=Delete" thats it is unable to do so, as Delete is not recognized.
Are there any way to do this? preferably from .pubxml, but csproj will do aswell. Not that much for having to deal with msdeploy command line.
Using visual studio 2015.
Came here looking for a way to keep the "certify the web" .wellknown\acme-challenge folders web.config during a Visual Studio 2019 publish. Thought I'd share it.
Adding the following to pubxml file will cause deploy NOT to delete the web.config during publish.
<ItemGroup>
<MsDeploySkipRules Include="CustomSkipFile">
<ObjectName>filePath</ObjectName>
<AbsolutePath>.well-known\\acme-challenge\\web.config</AbsolutePath>
</MsDeploySkipRules>
</ItemGroup>
Hope this helps somebody!
This (quite recent) SO answer mentions that MsDeploySkipRules settings are effective only when publishing through command line.
When Web Deploy-ing from VS IDE, it suggests checking the following options:
Remove additional files at destination
Exclude files from the App_Data folder
If "Remove additional files at destination" and "Exclude files from the App_Data folder" are both selected, EVERYTHING will be still deleted first and App_Data folder will be ignored (It wont be published).
The only recommendation I can give is to make the folder hidden, this way even "Remove..." is checked it wont be deleted.
I have an Asp.net 5 project with a package.config in the root. This creates a hidden node_modules folder in the root. Visual Studio can't see it (unless you choose 'show all files') and TFS does not see it.
Using gulp, I copy some files under node_modules to the wwwroot folder so they will be available to my client. I mimic the same structure starting with a node_modules folder in the wwwroot folder. I can't seem to hide these from VS/TFS.
I have a .tfignore file in the wwwroot folder with this line:\node_modules. I have also tried using .tfignore in other places, such as at the solution level. I can't get it too work.
I tried editing the project file and adding DnxInvisibleContent but it seems to only work at the file level and not on the entire folder. I have this entry which is not working:
<DnxInvisibleFolder Include="wwwroot\node_modules\" />
(I also tried DnxInvisibleContent)
I have this is project.json but it's not doing it.
"exclude": [
"wwwroot",
"node_modules",
"wwwroot/node_modules"
]
I am using Visual Studio 2015 with update 1. I don't really have to hide node_modules from VS but I need to hide it from TFS.
This is my project layout. I have one .tfignore at the project level and another inside wwwroot.
solution
-.tfignore
-Angular2Client
----wwwroot
-------node_modules
-------.tfignore
The contents of .tfignore at the solution level is:
\packages
\.vs
\wwwroot\node_modules
The contents of .tfignore in the wwwroot folder is:
\node_modules
Assuming you are using ASP.NET 5 RC1, it seems this is a known issue with ASP.NET 5 RC1, will be fixed in RC2:
https://github.com/aspnet/Tooling/issues/289
I am currently rewriting/cleaning up our TFS Builds, and I have noticed that we have a lot of duplication. I was wanting to create a "Common.targets" file which all our tfs builds (about 30) would then import.
I have tried a few things along these lines of:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\TeamBuild\Microsoft.TeamFoundation.Build.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft.Sdc.Common.Tasks"/>
<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>
<Import Project="$(BuildDefinition).proj"/>
<PropertyGroup>
<ProjectName>Felix.LincsPublishingHandlers</ProjectName>
</PropertyGroup>
<Import Project="$(BuildDirectory)/src/BuildScripts/Common/CommonTargets.targets"/>
</Project>
Where:
$(BuildDefinition).proj -> contains project/environment specific properties (eg db connection strings, IP addresses)
CommonTargets.targets -> used across all the various projects. Defined in the Build Definition > Source Settings
However when I try to run on the TFS Build agent (version 2010 if anyone needs to know), it tries to run the statements before it has copied down the source files. So I get an error saying that the CommonTargets.targets file doesn't exist.
I've had a look around the web, and the solutions I have come across so far have suggestions that I would prefer not to use:
Copy the Common.targets file under into the same folder that has the TFSBuild.proj file
I have 20+ builds in different folders
I would like them all to use a single common.targets file (not 20 copies of the same file)
Copy the Common.targets file to a location on the build server(s) that the TFS Build Agents can access
I want to have it in source control with the rest of the build scripts and code.
As we are doing a sort of migration project, the Common.targets will change a bit over time, so best to have in source control
Has come across any similar issue of trying to import a Common.targets file that is kept in TFS source control?
Thanks for any help
First, you should consider upgrading TFS as mainstream support for TFS 2010 ends in a few months.
http://nakedalm.com/its-that-time-again-get-ready-to-upgrade-to-tfs-2015/
Second, you should consider updating your build system to use a modern method. Use the TFS 2013 template and PowerShell.