When I edit the code I would like the cs file is became checked out automatically.
In the Tools -> Option -> Source Control -> Enviroment in the On Edit there is Check out automatically but it does not work.
Some help?
You need to ensure the files are read-only, or VS won't be able to tell that they are version controlled (or, at least that's what it uses to determine it). You can tell VSS to set itself up so getting the latest version places the files RW on disk.
There may be other problems here, but that's what comes to mind first.
Source: https://social.msdn.microsoft.com/Forums/vstudio/en-US/88d652fa-1fef-4e3c-8dcb-a2079a96f031/visual-studio-2010-automatic-check-out-not-working-on-file-edit-or-save?forum=tfsversioncontrol
Update: Read only possible reasons:
Possible problems:
Files on network drives. If the network is slow, the compiler can have trouble accessing the file.
File still open in (an other) editor. Normally this shouldn't be a problem, but you may never know.
Some code files are generated during the build. In this case they don't belong in the version system, their source (if any) does.
Hope this will helps you.
Thanks
Related
How can one debug the .NET framework source code using Visual Studio 2017?
There are some questions here on stackoverflow about this topic, but even after reading all of them, I still wasn't able to make it work.
I thought it would be useful to present an up-to-date, working solution about how to debug .NET framework source code.
I would like to solve it without using any external tools (e.g. dotPeek as source server).
First of all, I tested it using Microsoft Visual Studio Enterprise 2017, Version 15.9.7 and via .NET Framework 4.7.2. Though, I think it should work on Community edition the same way.
Steps to take:
Go to Tools / Options / Debugging / General, and perform these settings:
check Enable .NET Framework source stepping (this will automatically disable "Enable Just My Code"; if not, do it manually)
uncheck Require source files to exactly match the original version
check Enable source server support
Go to Tools / Options / Debugging / Symbols, and:
in the upper listbox check Microsoft Symbol Servers
click Empty Symbol Cache button (to make sure you will get the correct symbols)
select Load all modules, unless excluded radio button at the bottom
Download the source of the .NET framework version your project is targeting, from the https://referencesource.microsoft.com/download.html site.
Unpack the downloaded archive (zip) file to a convenient path on your PC.
Debug your application; set a breakpoint to the line of .NET code you wish to debug, and step to the desired code line with the debugger.
Note: your application may start slower since it will download PDBs from the internet.
Press Step Into (F11 by default). If your settings are correct, this will cause some delay (if your VS crashes (like mine did), Empty Symbol Cache again). Eventually it will ask for the sources of the given file, e.g. dictionary.cs.
Two things can happen here:
A) It asks for the source file (.cs) in a file dialog. Go to step 7.
B) It says whatever.cs not found, and there is a link that says "Browse and find whatever.cs...". Click that link.
Select the corresponding .cs file on your disk (you can search for the file on the OS).
Note: I had to restart VS several times until it "did not crash" while looking for sources, this is most likely a bug in VS.
If you did everything correctly, you will find yourself debugging the .NET source code.
Note: Since VS saves the path you entered for the source files, you can stop debugging or restart VS; it will work next time, too.
Besides, you do not have to manually select any more source files within the framework, because the VS will use the source folder you entered and will search in source files there.
Many people wondering why they can't step into source although they does set the checkboxes as described above. I'm, too.
Because you can extract dotnet sources to any location, Visual Studio isn't able to know about them and the reason can't be the source files itself (why Visual Studio doesn't find the files).
But some dll's are browseable, some not (through double clicking in Visual Studios stack view or context menu > goto source). This brought me to the assumption, that the .pdb itself must be the reason. If you look into a file which works (e.g. notepad), you see at beginning a list of strings with file pathes (source files). In files, which doesn't work, the files starting immediatelly with binary data.
For some reason microsoft doesn't create her .pdb's with full debug information in every build process. But why not - good question! g
In short: you have to search a dll version of your file (which you like to debug) which contains FULL DEBUG INFORMATION. This is also the reason why context menu disables "goto source".
I'm replacing this file temporary in global assembly cache for time of debug. This works for me.
Here an example of PresentationFramework.dll
- 4.0.30319.298 => pdb size: 1219 KB
- 4.0.30319.18408 => pdb size: 15.562 KB
Perhabs somebody can create a public database (wiki), which everyone can add files and versions for which full debug information are available?
(If you are like me and after following all steps you still can't step into code...your PDBs downloaded from Microsoft are wrong, try this)
Using JetBrains dotPeek as the symbol server worked for me. (4.6.2 framework) (I did everything mentioned in this thread and many more threads, and nothing worked)
https://hmemcpy.com/2014/07/how-to-debug-anything-with-visual-studio-and-jetbrains-dotpeek-v1-2/
JetBrains dotPeek decompiles your actual .NET DLLs, then hosts a symbol server that you download symbols from in Visual Studio. After a pretty slow download, then a restart of VS, I was able to breakpoint and step into the code.
You can find the path to your .NET DLLs in the "Modules" window when debugging in VS. Enter this into dotPeek. Then Host Symbol server in dotPeek. Then add http://localhost:33417 as your symbol server in VS symbol settings. then load those symbols. it takes a minute and a VS restart, but works.
I am working on a project and while compiling, my laptop handed up and I have to turn it off manually.
After the restart I found that my code is not showing up. There is no line of code in program.cs file.
I am working on that code since a month. And all of it vanished.
Need help. I have the executable file working properly. But i need the code. Is there any way to find that code ?
Use ILSpy to decompile your executable. You will get the source code back, minus the comments. This is possible because assemblies (like your exe) actually contain "Intermediate Language" (IL), and not native machine code/assembler. From the IL it is possible to get a reasonable representation of the original source code. You may need to recreate the csproj file manually, if you do not have it.
If you have the .exe you must have compiled it, if you compiled it you must have saved it.
Where it is depends on where you saved it. Easiest thing would be to use the search function in Windows – search for whatever you called your program, or failing that, *.csproj. Then you can open the csproj file with Visual Studio and you should get most of it back.
This question is NOT answered at the link above...
I had some problems with TFS where visual studio builds on the local machine no problem, but when I try to build on the server I get build errors. The errors are not relevant to this question.
The issue I have is that in order to fix the errors I had to manually edit some of the files on my local machine, and since they were manually edited, TFS doesn't detect the change so it wont let me upload my change set to the server which would have fixed the problems there.
My first, and main question is:
How can I force TFS to copy all my local files to the server. Sort of like the reverse of the whole:
Goto View / Other Windows / Source Control Explorer / Right click on the relevant project / Advanced / Get specific version / Check "Overwrite all files..." / Press ok.
Which (arguably, cause it doesn't always get everything in my experience) gets a full file set from the server to the local machine.
I am so tired of TFS uploading partial file sets and then when the solution is removed locally, and then re downloaded from the server, I have to pull in the missing files and references from some backup. If it was uploaded fully, and correctly at the start, I would probably have less of these problems. So this is my main question. How do I force TFS to upload all my files regardless if they have changed or not according to it.
To explain further a problem I am having in particular with nuget package manager. I disabled the option "Allow NuGet to download missing packages during build". So locally I got actual build errors. Yes that's right, Build errors. like this...
Project XXX: Package restore is disabled by default. To give consent,
open the Visual Studio Options dialog, click on Package Manager node
and check 'Allow NuGet to download missing packages during build.' You
can also give consent by setting the environment variable
'EnableNuGetPackageRestore' to 'true'.
Which now forces me to re-enable this option to get rid of the errors. I am annoyed at this because such errors should be presented as warnings so as not to prevent a build. This is seriously disappointing and as a result I have a very poor opinion of NuGet.
Anyways enough ranting, I re-enabled this, not like I had a choice. But the version where this was disabled went up to the server. Now I get this error on the server. I tried re-enabling it and doing a check in, but TFS wont let me. (Warning...No pending changes). Of course not, its just a silly check box. What could possibly have changed. But now I get an error on the server that I cannot fix all because someone at NuGet didn't put some taught into properly designing their warnings (as opposed to preventing a build by causing errors).
So, once again, how can I force TFS to take all my files, changed or unchanged, verbatim, to the server. This way, when I fix a problem locally, it "should" fix it also on the server. Or at least, when I next download it, I am assured to have the whole file set.
Apologies if this sounds like I am being negative, but I am at this for 5 solid days and it has completely stopped development costing me and the company a lot of money. Any help would be very much appreciated.
There is no way to tell TFS to take everything in my file system. What you need to do is a multistep process. First Check Out the entire directory, this will not overwrite your manual changes but will allow you to check back in and have it detect those changes. Second, if any new files were created you need to add at the root directory and get all new adds. Lastly check in all of your changes. It really should be that simple.
If you are using TFS 2012, then Local Workspaces would be a good solution for you.
Just to be clear - Local Workspaces does not mean that your developers are working locally. All code is still under Source Control in exactly the same way with Server Workspaces.
Local Workspaces are new to TFS 2012 and would resolve your issue. The main advantage for you is that files are no longer marked read-only. This allows you to be able to edit them from anywhere (notepad, any other IDE, Visual Studio) without first doing a checkout. Visual Studio will then automatically detect that the file has changed and list it in the Pending Changes window.
Good article comparing the different types of workspaces: http://blogs.msdn.com/b/willy-peter_schaub/archive/2011/11/30/team-foundation-server-trying-to-understand-server-versus-local-workspaces.aspx
I like to use the Source Control Explorer window, then right click on a folder and choose Compare. You can choose to see what is different in the target folder, or what is a new file. The files that are different appear in red. You can then right click on them and check out and check in files, or use control-click to select more than one file at time.
Yes i know before the flames start to arise, this is not conventional....but working in unity I encounter this problem quite often. Literally dealing with it now as i updated to unity 5.5 and it fubared a lot of stuff in my current project. After the resolutions from unity, my project is completely out of sync... and for whatever reason vis stu refuses to monitor these changes... It is rather annoying to be sure, but not to worry as I have resolved it successfully every time over the iterations by doing the following:
create a backup folder in a separate location and copy the entire thing over.
It doesn't matter where you back up to as long as its in a unique separate folder. Be sure to copy FOLDERS not individual FILES as some files may be hidden.
do a full get of the latest version (according to TFS).
This can take some time and is why you back it up in a separate location. Be sure to KEEP VS OPEN AT THIS POINT!!!
overwrite ALL the files you "got" with the backup that you made in step 1.
The local work-space will monitor the changes to the files as you overwrite them with the backed up copy into your local space, and mark them as having pending changes accordingly if the new one has any difference.
update your pending changes to the TFS server in source control explorer. Any change detected during the overwrite will be added to the included changes section.
Voila you have forced your files, work, and will onto the TFS server!
I used to be able to debug using Visual C# Express 2010 with no problem before. However, since I've opened my project using MonoDevelop (to port it under MacOS), I can't seem to be able to debug anymore.
The exact error message is available below:
A lot of people says to go in the configuration manager, which I'm familiar with, however, I can't seem to find it in the Express version.
Since you didn't have this issue prior to opening in Monodevelop, it more than likely changed something within the solution and/or project files. There are a number of posts on stackoverflow...
stackoverflow: no symbols
stackoverflow: no symbols when crossing module boundries
(From Răzvan Panda comment on the question)
... that talk about missing symbols. However, based on the information provided about monodevelop, I'd venture to guess that the IDE changed something within the solution and/or project files.
If your solution is under source control and you don't see any differences in these files, let me know. Otherwise, you could create a new blank solution/project file (from Visual C# Express 2010) and re-add all your files to it to get the default settings back and see if that resolves your issue.
EDIT: Also, keep in mind that there are ".user" files that I guess "might" have an effect on build/debugging configurations. If re-adding your files to blank solution/project files doesn't work make sure all the "extra" files like ".user" are not in the directory. Usually files like ".csproj.user", and ".suo". I've never had an issue deleting these they store local configuration changes that are not usually checked into source control.
I had same problem with Symbols when I added some dll to my project so what I did was to manually adding them. you can try going to tools > option > Debugging > Symbols and from there you can add the file root (in this case monoDevelop) and it automatically looks for all .pdb files and adds them to your environment. After rebuild it should be Okay.
Cheers
As George Duckett said:
Re. configuration manager, enable expert settings first. Tools->Settings->ExpertSettings. Then find it under Build->ConfigurationManager
Then changed it to Debug.
I've got licenses.licx file that is included to one of my projects properties. I am not sure how that is used by its dlls. Is it used by msbuild? Do you have any idea how it is used when the solution is building?
Since you indicate that StellarEleven's reply doesn't help, I guess you're looking for something even simpler. This is probably not 100% correct, but it is my understanding of how this works:
The licx file is simply a list of the "licensed" components used by your application.
Each line in the file is of the following format:
[Component Name], [Assembly Name]
For example one of my projects uses the licensed IP Works NetDial component so my .licx file contains the following line:
nsoftware.IPWorks.Netdial, nsoftware.IPWorks
In the context of the project (.csproj) file, the .licx file is referenced as an EmbeddedResource. During the build process, LC.exe verifies that the machine performing the build has the appropriate license(s) for the component in question, and generates a binary .licenses file which eventually gets embedded as a resource ([AssemblyName].exe.licenses) in the final executable.
Does this help?
Licenses.licx file woes
File this under ASP.NET, Department of WTF.
Frustration When you are developing a web application with our
controls, a mysterious file called licenses.licx appears. No, it's not
an order to use a weirdly-named lollipop, but is a transitional file
generated (and modified) by Visual Studio that participates in license
checking. In design mode, Visual Studio uses this file to make a note
of every licensed control you use in your design. When you then build
your application, Visual Studio read this licenses.licx file and for
every control mentioned there, will load the relevant assembly and run
the license code in that assembly to see if the assembly is properly
licensed (that is, that the product to which it belongs has been
properly installed on that machine). If everything checks out, Visual
Studio embeds the license key into the executable. If it doesn't,
you'll get weird error messages about the control not being licensed
(my favorite is "Could not transform licenses file 'licenses.licx'
into a binary resource." to which I usually invoke the colorful
language of my ancestors).
Licenses.licx is actually a file in your solution (if you cannot see
it there, click Show All Files). Visual Studio uses a program called
lc.exe to compile the licenses into embedded resources in your
application, and when things go wrong with the license compiling I've
seen error messages that reference this executable as well.
Here's an example of a line in a licenses.licx file.
DevExpress.XtraCharts.Web.WebChartControl,
DevExpress.XtraCharts.v8.2.Web, Version=8.2.4.0, Culture=neutral,
PublicKeyToken=9b171c9fd64da1d1
The first value in this comma delimited list is the class, the second
is the assembly where it's found, and the other values are the rest of
the assembly's strong name. I'm sure you can see problems already,
especially when you upgrade a solution to the latest versions of the
third-party controls you use. If you want, you can edit this file and
remove the strong name parts with no problem.
But that's not the biggest issue with licenses.licx. The thing is
Visual Studio has a propensity of touching this file if you open the
solution (that's "touching" as in changing the file date to the
current date/time). This plays havoc with licensing, especially if you
happen open the solution on a non-licensed machine and you are using
source control. Suddenly your build machine will throw off these
"cannot transform" messages and you're left wondering what went wrong.
Another prevalent issue is when you have a team of developers working
on a solution: they're all unconsciously "modifying" this file.
So, the answer seems to be not to put the licenses.licx file under
source control. (KB article)
But this solution to the problem throws another red flag: if one of
the developers in a team adds a new control that needs licensing to
the form, a line gets added to his local licenses.licx file and it may
not get reflected in source control. Bam, your build machine fails the
build and Joe, who added the control, has to buy doughnuts for the
team until someone else breaks the build.
I'm afraid I have no good solution to this latter issue, because
unfortunately the "not putting licenses.licx in source control" seems
to be the way everyone is solving the licensing problem. Another
solution is to delete the licenses.licx file altogether and then get
Visual Studio to regenerate it by opening the solution (although this
is a bit difficult on a build machine).
Anyway, hope that all helps in some way. And hitting your laptop with
a phone isn't really going to help.
We use a custom check-in policy (TFS) that explicitly nulls the contents of this while if present in the check-in list.