I was just tryng to create a simple webpart in visual studio 2010 (for sharepoint 2010)
I created an empty sharepoint project, then added a webpart. I wrote a simple code (pasting it from a book with examples)
I Build the project, then deploy it (without errors)
Then when i go to the webpage where i want to add my webpart, i get this error when adding it:
"unhandled exception was thrown by the sandboxed code wrapper's
Execute method in the partial trust app domain:
$Resource:core,ImportErrorMessage;"
Any idea about it?
If it's needed i'll post the code of the .cs file
Thanks
i don't know why but the second try worked
i can't say exactly what went wrong the first time, but i never get the same problem now
I've figured this one out, its something to do with the manifest and features xml files that are generated along with the project.
When you start you should have a namespace like this.
ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy
But for some reason in those xml files it's added as
ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy.
With an extra '.' (dot).
The fix open something like notepad++ do a search through the project and at first look for
ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy..
They should be in the manifest/features files. Change to a single dot so should have something like
<type name="ASMLab4.DisplayWebPartWithProxy.DisplayWebPartWithProxy.DisplayWebPartWithProxy, $SharePoint.Project.AssemblyFullName$" />
Next do a search for a single dot. There should be one in the safe list, remove the single dot. Try the deployment again - should be ok.
Related
I'm working with XNA 4 in VS2010. Recently a crash corrupted a .contentproj file of mine. So I deleted the content project inside VS, created a new one and repopulated it with the contents of the old one. However the new content project did not properly hook up to the rest of the program, whenever I build the program its contents aren't translated to .xnb-s and placed inside the content folder of the game as when I built the program with the original content project.
I'm sure I'm missing a step in reconnecting the new content project, I just can't seem to be able to find out what that step is. Any ideas?
Thank you.
Take a look at the properties of the imported files in Visual Studio and check they are correct. Check the Build Action specifically. It should be set to Compile.
I found a way to make it work. More a workaround than a solution, I created a new VS solution, imported everything other than the content project from the old one and used the content project that came with the new solution.
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.
Apologies. I am sure I should know where to look to deal with this but I do not:
The error below has appeared in my solution. I am not aware of why.
The item
"obj\Release\ScruffyDuck.AirportDesignEditor.MainForm.resources" was
specified more than once in the "Resources" parameter. Duplicate
items are not supported by the "Resources" parameter. Airport Design
Editor
Perhaps someone would be kind enough to put me out of my misery and tell me where to look.
Thanks
OK I found it. I have no idea how it happened. However it might be useful for the future. MainForm has a number of files containing different parts of the class. The main part has all the designer code and so on. Somehow a .resx file got created on one of the partial class files along with an InitializeComponent() method. Removing the extra .resx file got as far as reporting the duplicate method and removing that allowed the solution to compile again. It seems that though the file names are different (the error was in MainForm.EventHandlers) the two resx files are treated as the same even though they have different names.
I am now getting some exceptions but at least I can get the code running in the debugger again.
I think you'll have to open your .csproj file, and look for that file name. It sounds like ScruffyDuck.AirportDesignEditor.MainForm.resources is appearing more than once. Just remove the duplicate node (.csproj files are just xml).
Just remove obj directory from HD manually.
Clear solution from Visual Studio (Right click on project in SolutionExplorer and select "Clear")
Rebuild solution.
Cause could be a fault of generated resource file, due some conflicts happened in your project.
Should work.
Regards.
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.
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.