Export Visual Studio Template error: "Unable to read an exported file" - visual-studio

When exporting a Visual Studio project to a Template (File/Export Template...) I get the following error upon clicking the Finish button:
Unable to read an exported file for the following
reason: The file cannot be opened with the selected
editor. Please choose another editor.
Screenshot http://img687.yfrog.com/img687/1756/templateerror.png
A Google search for this error has only led to several dead ends. There aren't any unusual file types in this project. Any ideas what could be going on?

By laborious trial and error (start with an empty project, add a folder, try to export template) I was able to narrow this down to a single Javascript file. As it happens, it's one of the language definitions for prettify.js (which is used on this site for code coloring). The file in question is lang-hs.js, and for some reason Windows on my machine treats this file differently from other Javascript files: It opens in Notepad, when I have the .js extension mapped to Visual Studio.
I'm not sure what the underlying explanation is, but I've already wasted enough time on this and I believe I can live without Haskell code coloring (!) so I'm just deleting this file and moving on.

It seems ".cur" files are often a culprit in this error. I have removed them from my project and now the exportation works correctly.
Microsoft staff suggest looking at log files (../windows/system32/compmgmt.msc) but this error does not spawn an entry into the Application EventLog.

Related

SSIS script task "The binary code for the script is not found"

This problem is very similiar to those:
"The binary code for the script is not found" and
The binary code for the script is not found” ssis
I have an SSIS project with multiple script files. SSIS claims that one of them has no binary even though there should be. There are no code errors, and I can build it properly. I suspect it's a VS bug because this problem appears and disappears randomly. What I mean by that is that this script is working fine, I open it to see the contents, close and suddenly this error happens! So I open it like 20 times, and it (without me doing anything) repairs itself! Any ideas on how to make it work better? It seems (though I can't confirm with 100% certainty) that this problem happens when you save the SSIS script (as in use ctrl+s) instead of simply exiting from the VS.
Things that I have tried that sometimes work:
Restarting Visual studio, opening the script without doing anything, closing it
Adding a small change to the code, exiting
Removing and adding breakpoints
Going on my knees in the direction of Redmond, Washington, and chanting the names of M$ presidents while opening and closing windows in the building to the rhythm of the windows starting sound
Randomly closing and opening the project, as well as going through items in the script component menu
Things that don't seem to work: rebuilding project, cleaning project, you know the standard stuff
I've found a solution that OFTEN works. Notice the usage of often.
1) Try restarting your computer.
2) If it doesn't work go to your system temp files directory, and find the location of SSIS temp projects (you can also open the script, right click on C# project, explore in windows explorer). Delete the project. (Make copies before deleting just in case). Start Visual studio, and once again edit script, close, hope it works. DON'T SAVE THE SCRIPT PROJECT BEFORE CLOSING! JUST CLOSE!
Note that for the second step, you can also try using a cleaning tool, like CCleaner of similar.
In my case, I did some idiotic changes to main package solution config manager and tried changing the "Target SERVER Version". That wiped out all the scripts project from each packages. Then I came to know that it is auto-generation everytime we open. That means each package is storing script project within it. But now I don't know why its not generating while pressing on "Edit Script button" (really pissed!)
Thank for suggestion. In my case, I did some idiotic changes to main package solution config manager and tried changing the "Target SERVER Version". That wiped out all the scripts project from each packages. Then I came to know that it is auto-generation everytime we open. That means each package is storing script project within it. But now I don't know why its not generating while pressing on "Edit Script button" (really pissed!)
"Lucky I am" . got an fix! Each package file was internally not linked with their Script.cs. So I opened each package file in Notepad++ and found Script.cs content within. I recreated scripts.cs in each package (steps) and pasted the content from notepad++. And it worked!!!

Visual Studio: Open up a symbol source file prior to debugging and set breakpoint

I have a project where the referenced assemblies have symbol files available. Both pdb, and the source files themselves. (they are all my own libraries). The symbols are all listed in the Tools / Options / Debugging / Symbol marking their locations. Thats all fine.
But it's working with them, i'd like to know:
Is there a way in Visual studio to set a breakpoint in a file of the symbol before having to debug line by line to get to the code in question.
To be clear, if i step line by line i can eventually hit the source (because of using the symbol files) code i'm after. But some times getting to that location is not easy, because it's so nested within multiple symbol files. BUT once i eventually step deep enough and find the code, i can set the breakpoint, and from there on stop and start the main application and get to that location without trouble. The file code and all is even listed in the open file pane, for easy view.
Is there any way, if i know the file and line of code i want to break at, open that file in VS and set the breakpoint directly?
Hopefully i was clear in the description. Let me know if i need to reword.
tx
I bet the code you want to put a breakpoint is in a function (;)) so I would use a New breakpoint option from Visual Studio. This allows you to put a method name that VS should break on when entering the method (so basically on the first { after the function name).
After pressing CTRL+B you will be presented with the dialog
Here you specify a function name you want to put a breakpoint on.
You can just specify just the name (like. AppendText) or fully qualified name (with namespace - System.Windows.Forms.TextBoxBase.AppendText). If you want to narrow it down to a specific module user module_name!function_name syntax. If needed you can specify on which of the overloaded function you want to break on.
All this info you can get by hovering over an (i) icon on this dialog.
OK. Knew there had to be a way. And it's very simple.
As stated, if you have the symbol and source available for the Nuget packages you are working with follow these steps:
open the main project in question in Visual Studio.
In VS, click File / Open File...
Under your PACKAGES Folder, locate the package for the reference you want to set breakpoint.
In that package locate the source code folder that was packaged along with the pdb file.
There you will find the source code. Now locate the file you want the breakpoint placed in. Click that file to OPEN the file in Visual Studio.
That file is now OPEN in your VS viewer, but it is not included as a new file in your project (good thing).
Place breakpoint where you want.
Run solution. Now you don't have to step through your entire solution to get to the code you wanted to review with that breakpoint!
what a relief!

Cannot open other member's project in Team Foundation Server?

I don't understand how it works. I'm new to Team Foundation Server and currently I have a small team. The co-worker can open my project file and run just fine (by double clicking the solution file right in the source control explorer window).
I can open my project file the same way but cannot open his project file. Clicking the solution file does load the solution but the files in there cannot be opened. It says something like this:
Cannot find the file "d:\....". It may have been moved or deleted.
The path "d:...." is actually the path on his machine. While in my machine it's mapped to a different path. But I don't understand why it cannot recognize it.
At first I thought the mapped path structure should be the same across all members' machines but if so my co-worker could have not opened my project file.
The status of the solution is Yes for Latest, meaning the files are loaded and copied to my local folder normally. Not sure if it matters but I'm using Visual Studio 2015 and my co-worker uses Visual Studio 2013.
I've tried searching around but could not find anything with the error message. It's so interesting that my co-worker does not have to do something special or self-aware so that he could tell me something to solve this. I hope you have some experience on this and give me some helpful suggestion. Thank you!
Edit:
To clarify it more, if I browse the file directly inside the source control explorer window, the file can be opened (but if it such as is some designer-supported file like .xaml - the designer then is not shown up). What I'm having trouble with is opening the file loaded in the solution (inside the Solution Explorer window). As I said clicking the solution file in Source Control Explorer window does load the solution, but because there is something wrong with the files path, I cannot open them as well as build and run the solution.
Right-clicking on the file in the loaded solution, select Properties, I can see that the Full Path is actually the path on his machine, so weird.
It sounds like your workspace is all messed up. Are you trying to share a workspace?
If so you should not. Each developer should have their own workspace local to their computer that is unique to them.
Try creating a new workspace and using that...

Share a link to a location in code (source file / line number) in Visual Studio

I'm looking for a plugin (may be a TFS plugin) for Visual Studio 2010 that add a 'Copy uri' context menu entry in code editor and would make possible to copy paste a file/line number into an IM conversation (skype) or an email, and of course clicking the link would open the project/file at the correct line number (in an existing instance if VS if possible).
I'm working from home and that would be nice to be able to share easily a code location with team via skype (and sometimes email).
I googled and found nothing, but it's perhaps available in a big plugin like Resharper and not advertised.
I wrote an extension for this. It's called CodeLink:
https://marketplace.visualstudio.com/items?itemName=AuriRahimzadeh.CodeLinktm
I'm looking for testers and feedback. I only have so many solutions with which to test it :)
There's no such extension that exist from what I know.
However it wouldn't that hard to create a VSX that adds an entry in the Source Code context menu that will get the Source Control path from the Local Path using the TFS Api then putting the result in the clipboard.
In the meantime there's no easy way to come up with a workaround as I'm not aware of a way to get the Source Control path from the Local path in Visual Studio.
Its not a plugin, but you can now add a line parameter (eg &line=1234) to a TFS file browser url, and then email that link to a colleague, it will open the file in a browser with the specified line highlighted.

generation of designer file failed

Every few days VS2008 decides to get mad at me and fails to generate a designer file claiming it cannot find the file specified and that it's missing an assembly. Here's the scenario:
The aspx page has a reference to a custom user control (inheriting UserControl) which references another assembly in the backend. There are many other references to this "missing" assembly in other places in code which don't throw errors. rebuilding, updating the source to the clean copy, shouting at the computer, punching the screen, etc all fail to work.
Any suggestions? This is quite annoying.
We've had similar problems before, unfortunately I don't remember the exact solution.
If your using a "Web Site" project (no project file) then start by checking that both your page and your control both set the ClassName property in the first line of your aspx/ascx file and that you specify the full name of the class including the namespace.
Example:
<#Control Language="VB" AutoEventWireup="false"
ClassName="YourProjectName.YourUserControl"
Inherits="YourProjectName.YourUserControl"
CodeFile="YourUserControl.ascx.vb"
%>
Many times not setting all of these will still work but you will get odd compiler errors and behavior in VS.
If you using a Web Site Application project try deleting the designer file manually and then right click on your project and choose "Convert from Web Application." This will should recreate the designer file for you.
My only other suggestion would be to recreate the page and/or the user control from scratch.
Jared, you've hit it. Using "Convert to Web Application" to manually generate the designer file solves my problem. I'm glad you posted this before i started reinstalling. Thanks.
You might try archiving a template of a new file with its designer equivalent. If VS coughs then you can do an "Add Existing" option with the file you already have.
It seems, however, to be an issue with your installation of VS2008 so you might try reinstalling it.
I found that using a custom control, you would need to add a reference to the .dll. This fixed it for me after migrating from a web site to web app.

Resources