ASP.net 5 wwwroot source control (TFS) ignore compiled TS Files - tfs

I have my grunt file building the TS files and placing them in to the wwwroot folder. TFS/VS Keeps thinking that they are new files and adding them to the pending changes.
How do I make is so this is not happen. I only want the TS file in source control.
Update:
I have tried using .tfignore file
# Ignore all files in the wwwroot sub-folder
\wwwroot\

TL;DR
If you want to do front-end dev in Visual Studio 2015, don't use the ASP.NET 5 project template. Use the ASP.NET 4.5.2 Empty Web Project template. NPM, Bower, Gulp, Task Runner all work there too. Just add the appropriate config files through the New Item dialog (NPM Configuration File, Bower Configuration File, etc.).
Though ASP.NET 5 was released with Visual Studio, it is still very much beta. That doesn't only apply to the server-side features. The VS project type is also not ready for prime-time. The project properties are very limited in the UI. You can't choose to exclude items from the project. package.config exclusions don't appear to affect anything. VS doesn't behave with TFS on these projects and performs a TFS ADD on any generated file. This means that if I don't manually fiddle with TFS changes, eventually gulp builds will fail because it will want to make changes which TFS will block (e.g. delete when there is already a pending change).
All in all, the ASP.NET 5 project type is not full baked just yet. Fortunately, the only thing it really provides over the 4.5.2 project (that I've noticed) for the front-end developer is the Dependencies node in the project tree. That has some utility, but is not worth the cost currently. Instead, I installed the Visual Studio Command Line extension, which makes it convenient to run bower and npm commands as needed. I had to do this anyway for tsd (TypeScript definitions) since it doesn't have a GUI, intellisense, or bindings for its config file.

Add a .tfignore file. Details here: https://msdn.microsoft.com/en-us/library/ms245454.aspx#tfignore

You are using a Web Site project type and not Web Application.
Web site is only provided for legacy support and does not support features added to visual studio after... Well.. For a very long time > 5 years. Web site projects are inherently greedy with files and this is by design and can't be changed.
You should upgrade your project to a web application by creating a blank web application and doing the core files into your website and then opening it in vs. You will see that it has no files and you need to manually tell it which files to load.

This was a bug in the asp.net core tooling/TFS souce control interaction and has been fixed in VS 2015 Update 3, where the .tfignore file instructions should now be honoured:
https://github.com/aspnet/Tooling/issues/18

Related

Should umbraco & umbraco_client be checked in to source control?

Just installed the latest Umbraco (7.2.1) package via NuGet. My development environment is as follows:
Umbraco is installed installed on IIS8 as shown below and is all up and running.
My Visual studio project is set up as shown below (For the sake of clarity, any folder/file excluded from project is not in included in my source control.
The content folder houses all scripts, images & css
On build - bin, config, content, masterpages, usercontrols, Views, xslt, default.aspx, Global.asax & the transformed Web.config are copied to the IIS instance (I don't like running Umbraco in the same place as my project, it just seems messy.)
Is this an appropriate way of developing for Umbraco? Am I missing anything, my biggest concern is whether or not I should include the umbraco & umbraco_client folders in version control and in the post build action. Any suggestions would be great.
There is some debate over what should and shouldn't be in your repository and ultimately it comes down to personal preference. I used to only add custom files and files that I changed from the Umbraco install such as the config files however since the introduction of the Nuget package I do put all but the binaries into source control because when I upgrade via Nuget later on I can easily see changes and merge customisations back in.
It saves a lot of hassle running Umbraco directly (IMO) especially if you make any changes via the UI and if you're not running it directly then there is little point really in using the Nuget package because you will end up with a bunch of unused files in your project. In your situation you might as well keep your project clean and do a manual install into the location IIS is using for the site and only keep files in your project that you have created.
This is only my opinion so take from it what you wish but hopefully it is of some help.
Simon

VS 2013 - pdb files are added automatically to source control

I have a solution with a web site project and two library projects (.dll).
The web site has references to the two dlls. The references are added as project references.
The web site also has a binary reference to log4net.dll.
When we build the solution the pdb files from the two project references is automatically added to TFS source control under the web site Bin folder.
How can I prevent this from happening?
Peter B. Frederiksen
By defaut a Web Site project has no option to include or exclude files. As such they do not work well with source control systems and are not recommended for use.
You need to flip over to a Web Application. This is simple but has ramification.
Create an empty web application
Update the settings and assemblyinfo to be what you want
Copy only the Project file and the AssemblyInfo files into the Web Site location (maintain folders.)
Add the new project to your solution with "open existing"
Make work / build
Remove web site from solution
Remember that your files are now pre-built and you may need to fix duplicate class names that are allowed in web sites.
It looks like from the diagram above that your bin directory was somehow checked in as part of source control, this directory should be deleted (bin) from tfs unless you intend to version the output, which in this case you should not.

Customizing Drop Folder Structure with TFS Team Build

I'm using TFS 2012 to automate a build of a solution which contains multiple windows services and two web applicaitons.
I've used the guide I found here to customize the build process template so that the windows services are put in a folder structure that I like. Specifically:
\dropserver\droproot\MyApp\BuildNumber\
\Service1
\Service2
\Service3
\Service4
This works great, but unfortunately it doesn't work for web applicaitons. If I used the same strategy for those, I just get the contents of /bin for each web app, rather than the full site contents.
MSBuild typically uses the web application targets to handle this, but for some reason, this doesn't work when you customize the build as I have. I no longer get the _PublishedWebSites folder in the build output. (I'm guessing that's because I cleared our the OutDir property of the MSBuild task.)
Has anybody done something like this and gotten it to work with web applications as well?
I think I can help with this, it looks like in the build targets that the published websites folder isn't created if the OutDir is the same as the OutputPath.
So this isn't perfect, but if you add the following into the csproj file in the first property group, you'll get everything deployed into "\bin\deploy\" including the _PublishedWebsites folder
<DeployOnBuild>True</DeployOnBuild>
<OutDir>bin\deploy\</OutDir>
With a bit of customization, this solution ended up working for me:
http://www.edsquared.com/2011/01/31/Customizable+Output+Directories+For+TFS+2010+Build.aspx
Basically, did what that link recommended, but also leveraged a new solution configuration (which I called TeamBuild) rather than conditional property definitions.
I believe the key to making this all work was the passing of the outputDirectory as the TeamBuildOutDir argument to MSBuild. Embedding this variable reference in the OutDir or OutputPath variable was allowed Team Build to build to the correct staging location and then automatically copy files from that location to the drop folder.
I'm going to take this a little futher and get rid of the whole _PublishedWebSites thing, but that will be done entirely in the build workflow.
EDIT: TFS 2013 supports this natively with a simply build configuration option:
Take a look at this thread as this post as well.
Team Build: Publish locally using MSDeploy
Since you need all the files for your web projects, you need to trigger the publishing process, and by tweaking the destination of that process, you can have all of your files copied where you need them.
I think option (2) from his answer will work for you.
I hope that helps.
As I can see in your reference link, it will just compile and package the binaries. It does not deploy the website by the steps mentioned in that.
If you want to get the .html, .css, .js etc. under the _PublishedWebSites folder, you need to do a Web Deployment. This manually we can do by clicking the publish option from right click menu of your VS project and by selecting Publish Method as File System.
But, since you need to automate this in your build and drop it in custom drop folder, you may need to manipulate your MSBuild script by calling a AspNetCompiler task. You can get more information on this at the MSDN link. By specifying the TargetPath while you call this target you can get your Web files deployed at the appropriate custom drop folder.
Happy Scripting.
Have you check this blog, this solved my problem where I wanted customized TeamBuild Ouput Directory.
Customizable O/P with TFS 2013
Customizaable O/P with TFS 2012 and .NET Framework 4.5

TeamCity Build Web Solution with Multiple Projects ASP.NET MVC

I have what I believe is a really common scenario with an ASP.NET MVC 3 solution. It has a WEB project and a DAL class library. I have the all my data access in the class library, which is required to be built before the web project.
When I rebuild my solution in standard Visual Studio I have no issues. But lets say I make a data change (for example to the database) and check in the DBML (LINQ to SQL) file and the corresponding reference files from the WEB Project.
What I'm seeing is TeamCity not cleaning/rebuilding the class library DLL at all. Below is my solution configuration. How can I force TeamCity to rebuild each project as it doesn't seem to be doing such. I have to actually check in the bin/debug DLL locally in order for TeamCity to successfully build. I feel that should not be the case. Do I need to setup a build step for each project...?
How can I force TeamCity to rebuild each project as it doesn't seem to be doing such.
I think the surest way to do this is to enforce a clean checkout of the source tree prior to each build. (see also: nuke it from orbit.)
You can have TeamCity do this for you by enabling the Clean all files before build option on Version Control Settings -> Checkout Settings. This option deletes the entire checkout directory and does a full, clean checkout of all the sources prior to the build. The TeamCity 'Clean Checkout' documentation has more info.
Sounds like your build configuration (in Visual Studio) is messed up.
First off, make sure your DAL reference is a project reference, not a file reference.
The easiest way to correct this is to remove the reference and re-add it. While adding, ensure you are looking at the projects tab. This should reset the project dependencies.
To ensure that the MVC project depends on the DAL project, right-click on the MVC project and select Project Dependencies... from the context menu. The DAL project should be checked.

TFS with different binaries folder for different projects

I've got a solution with Silverlight projects, a couple Web applications and some Windows service and their small Winforms test applications.
When I build it using TFS it puts all binary files in the Binaries folder. It also creates a _PublishedWebsites folder where it puts the web applications ready for deployment.
What I would like is for a few of the projects to have their ouput in a separate directory in the Binaries folder. I want the files that I would normally find in the bin\Release folder to be there.
I looked long and hard and could only find scarce documentation on how to achieve that and only for TFS 2008. There's a good article there link text and another entry for VS 2010 there link text. However, none of these work :-(
It seems that the build ignores the <OutputPath> property. I tried fiddling with the <AfterBuild> property but unfortunately if I use the $(OutDir) property I get ALL the files in the Binaries directory and not only the ones that just got compiled.
At the moment I'm setting up a separate build that only has the projects I'm interested in that get compiled but I would really like to have all the files needed for the release built all at once.
EDIT: I didn't make it clear enough but I'm using the latest version of TFS (TFS 2010 RTM). I set up <OutputPathDir> on the project level as explained in the links that I provided.
Cheers.
In your build definition (.proj) file, check that
<Project>
<PropertyGroup>
<CustomizableOutDir>true</CustomizableOutDir>
</PropertyGroup>
</Project>
Also, you may run into some problems if you're trying to compile what was once a "website" project type (created from File->New->Website->ASP.NET Webiste). They seem to override the output directory every time. We had to convert some of those to class libraries instead.

Resources