How to exclude folders when using TFS in vscode? - c#

I am using Visual Studio Team Services extension in VS code for check in. https://marketplace.visualstudio.com/items?itemName=ms-vsts.team
I am now trying to check in change in angular project, but I am annoyed by excluded 16000 files which are from node_modules:
How can I exclude those files from source control? In Visual Studio I used .tfignore file, how about vscode?

I had the same problem creating a dotnet core 2 cli react project using visual studio code and TFVC. I created a .tfignore file in the root (same place as the .gitignore).
Then I copied the content in the .gitignore file into .tfignore file, save and done...

So I followed everything that the others mentioned, but was missing the following, for .tfignore to skip the files:
Place the following in you Visual Studio Code's settings.json file.
"tfvc.restrictWorkspace": true
settings.json location:
File - Preferences - Settings (top right-hand corner(Open Settings (JSON)))
That I found the answer here.

Related

Why Visual studio 2017 is publishing entire solution?

Installed VS2017 from scratch and moved existing vb.net, c# webform solutions to the new laptop.
First issue was related to "The target GatherAllFilesToPublish does not exist" error which I fixed by opening vbproj (or csproj on another project) and add this line:
<Target Name="GatherAllFilesToPublish">
</Target>
Now I was able to publish with no errors but the output in the destination folder is the entire solution including .aspx.vb or .aspx.cs files, .Global.asax.vb, .aspx.designer.vb files etc.
Checked the project Package/Publish Web settings and Items to deploy is set to "Only files needed to run this application".
Still the publishing copies the entire solution instead only the aspx, dll and only what is needed. Any idea what I am doing wrong ?
Edit csprojfile,in that file change vs version of your old project to vs 2015 in property group.save the file and rebuild .it will work properly.

Replace matching files with local copies VS2015 publish

I remember that in Visual Studio 2010 there was "Replace matching files with local copies" checkbox
Where this checkbox/radiobutton in Visual Studio 2015 ?
In VS2015 it's not possible to set this option in the Publish Window.
But we can do it in another way. Right Click on Project->Properties->Package/Publish Web->Items to deploy
According to MSDN you we have these options
Only files needed to run this application. This is the default value. Visual Studio tries to determine which files are required for
the application to run successfully. For example, this includes
assemblies in the bin folder, files generated during the build, and
files marked as Content. To see if a file is marked as Content, select
the file in Solution Explorer, and check the file's Build Action
property in the Properties window. You can change the Build Action
value to Content to cause the file to be deployed, or change it to
something else, such as None, to prevent the file from being deployed.
Some file types that are automatically set to Content include .master,
.svc, .ashx, .asax, .skin, .browser, .config, .and sitemap. A file
must be included in the project in order to have a Build Action
property.
All files in this project. Visual Studio deploys all files that are included in the project, regardless of their Build Action property
values.
All files in the project folder. Visual Studio deploys all files that are in the project folder and subfolders, regardless of whether
they are included in the project or their Build Action property
values.
UPDATE
I figured out another method how to update all files during publishing. I faced issue when some of my files were not updated properly (config,ascx and etc.), in my inetpub folder I had old version of files. So first I published site in another new folder and then replace files in inetpub folder with files from new folder.

visual studio generates executable from C# but where are the obj files?

I have Visual Studio Express 2010 installed, and have used it for a C# project.
Now I am writing a .gitignore file so I can exclude from git the object files that I expect to be generated.
I come from a C++ world mainly.
Trouble is, despite the fact that the target is being generated correctly I cant see any object files (with .obj or .o extension)anywhere in the directory tree of the solution.
Could this be caused by the configuration where they are being sent elsewhere?
To answer your direct question: C# doesn't have a compile step that produces .obj files like C and C++ do.
However, a .gitignore that's appropriate for C# projects is a well-solved problem. Visual Studio will ask you if you want to add the .gitignore to your new git repository when you create it. If you already have a repository, you can just use the community's .gitignore for Visual Studio which is excellent (and what Visual Studio would install for you.)
There aren't any .obj files generated during compilation, but there is an obj directory under the project root that's used to store temporary files. This is the directory that should be in your .gitignore file.

For a Silverlight 4 Visual Studio solution, what needs to be in version control?

I have a Silverlight 4 app that I'm building with Visual Studio 2010. I'm using Mercurial/TortoiseHG to do version control. Which files do I need to check in? By default, it checks in all sorts of .dlls in /bin/debug and stuff. Do I really need those? Or can I just grab code and content files? Do I need to version something to keep track of project properties and references, or is that contained within the .csproj file itself?
You don't need to include stuff in /bin or /obj. This is true of all VS solutions in source control. These are recreated upon every rebuild. Also, for Silverlight specifically, you don't need to check in the XAP file that is generated in the ClientBin of your web app.
From MSDN (via this social.msdn thread):
You can add the following files to Visual Studio source control:
Solution files (*.sln).
Project files, for example, *.csproj, *.vbproj files.
Application configuration files, based on XML, used to control run-time behavior of a Visual Studio project.
Files that you cannot add to source control include the following:
Solution user option files (*.suo).
Project user option files, for example, *.csproj.user, *.vbproj.user files.
Web information files, for example, *.csproj.webinfo, *.vbproj.webinfo, that control the virtual root location of a Web project.
Build output files, for example, *.dll and *.exe files.
It doesn't say anything specific about Silverlight projects though.
Is Mercurial/TortoiseHG integrated into Visual Studio? i.e. can you check out/submit from within VS?
If so, if you right click on the project name and select "Add Solution to Source Control" it should add those parts of the project that it needs ignoring everything else.

C# SLN file approach in Eclipse (Java)

How does Eclipse handle excluding Java files in the project??
In C# the list of files in the project is handled in the sln file - There seems nothing similar in Eclipse!!
Any ideas?
In Visual Studio files for C# projects are stored in the .csproj files. Solutions are just containers for projects (which can be C#/C++/VB/... projects).
The last time I worked with Eclipse all files beneath the project's root were automatically included. When one was excluded from the build the project's .classpath file was modified:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="ExcludedFile.java" kind="src" path="src"/>
<!-- ... other entries ... -->
</classpath>
You can exclude a file in Eclipse by right-clicking it in the Package Explorer and then choosing Build Path -> Exclude.
Project specific meta information (like this) is stored in either the .project or the. .classpath files in the root of the project. These are hidden in the project view, but visible in the navigator view.
You shouldn't need to directly edit the .project and .classpath files mentioned in the other answers. As with Visual Studio, the IDE generates and owns these project meta data files for you.
For example, you can exclude an individual java file from the build path by right clicking on it in the project explorer and selecting "Build path / Exclude". That will make the required .classpath changes for you.

Categories