I have a runtime System.Resources.MissingManifestResourceException on my VB.Net VSTO. I read this was likely due to wrong settings in my resources file. So I went into the properties and made sure Build Action was set to Embedded Resource(and it was).
Just below, I saw Copy to Output Directorywas set to Do not copy. I thought it would not hurt if I just changed it to Copy always and gave it a try to compile.
It did not fix anything, but now Build Action has changed to Content, and I have dozens of BC30456 errors:
'Resource' is not a member of 'WordAddIn.My'
When I go to the error, I end up in a UserControl designer, and the line with an error shows: Me.Button_Foo.Image = Global.WordAddIn.My.Resources.Resources.Resource_Bar
I did set my resources file settings back to what they were (Embedded Resource, and Do not copy), but the errors remain..
Note: the namespace of Resources.Designer is My.Resources, and the Resources class and its members are Friend. However intellisense does not let me access the namespace from any of the objects where I have the build errors. I have tried changing the "Custom Tool Namespace" for other names but It does not appear from anywhere in the project. (the custom tool does update the Resources.Designer.vb file, and I would say it does it properly)
UPDATE
Resources.Designer.vb is not included in the project, but shows in the "Miscellanous Files". Same symptom as this post: Visual Studio - project shows up as "Miscellaneous Files"
I did (1) exclude the Resources.resx (cannot work on Resources.Designer.vb alone) from the project, (2) clean the solution, (3) restart Visual Studio, (4) clean the solution (zust'in'kase), (5) an then re-included it, the problem now is that Resources.Designer.vbis included in the project, but does not sit as "embeded" within the Resources.resx, so I am afraid I might have broken it?
The fix with Visual Studio 2017 was the following:
Note the Custom Tool namespace: in solution explorer, right click the Resources.resx file -> 'Properties' and memorize the value for the 'Custom Tool Namespace' field. (needed for step 6)
Remove the Resources.resx and the Resources.Designer.vb files from project: in solution explorer, for each file, right click -> "Exclude from project"
Clean / Rebuild solution
Restart Visual Studio
Re-include the Resources.resx file , but not the Resources.Designer.vb: in solution explorer, make sure you have the [Show All Files] button enabled (near [Refresh]); the resources file should appear with a greyed folder/file symbol next to it; right click -> "Include in project" (or alternatively, right click on the 'My Project' node and choose 'Add' / 'Existing item..'
In solution explorer, right click on Resources.resx -> 'Properties': make sure 'Custom Tool' value is "PublicVbMyResourcesResXFileCodeGenerator"; and that 'Custom Tool Namespace' corresponds to the value it had before you removed the file from project (see step 1.).
In solution explorer, right click on Resources.resx -> 'Run Custom Tool'
A new designer file should be generated automatically.
Related
How do I add a linked file to the My Project folder in VB.NET in VS.NET 2010? A 'linked' file is when you right-click a project in VS.NET, select 'Add -> Existing item...' and in the file dialog, click the arrow to say 'Add as link'.
I am trying to add a shared 'SolutionInfo.vb' file to my project, but I want it next to the 'AssemblyInfo.vb' file which resides in the 'My Project' folder. Simply dragging it into the locating in Solution Explorer is not allowed. The file is added successfully but it is in the root of my project. I want it inside the 'My Project' folder.
Anyone know how to do this?
P.S. C# folks, I know this same thing can be done and you can drag the file into the 'Properties' folder which is where the AssemblyInfo.cs file resides in C# projects. So in C# not a problem; just VB.NET.
You didn't originally say which version you're referring to, but I had VS2010 open when I answered the question.
Instead of Drag'n'Drop, with the mouse, Cut'n'Paste, with the keyboard, works!
That is, create the linked file in the top level, then select it and type Ctrl+X to Cut, then select a file within the My Project folder (with Show All Files on) and type Ctrl+V to Paste.
What is a standard way to open the Designer (automatically generated) code for a VB file?
As a workaround, I can get to it by searching the entire solution for some keyword that is usually only found in those files: Global, Partial, etc.
Open the Solution Explorer. Along the toolbar at the top there is a tool Show All Files (it is the 2nd from the left on my version of visual studio). Click on that tool. All of your Form files will now have an arrow beside them. click on that arrow to expand. Look for the code file named FormName.designer.vb. Double-click on it to open.
You have to click the "show all files"-Button. Then you can also see the Designer.vb-files.
Note: For C# and VS 2008, but the same applies to VB in VS 2010.
http://peterkellner.net/2007/12/31/visualstudioshowallfiles/
http://blog.brianhartsock.com/2009/09/14/visual-studio-tip-show-all-file/
Keyboard shortcut for Show All Files
Show All Files is a useful little button in the Visual Studio solution explorer to give us a full view of the directory structure our project files are sitting in. When it is off, we only see the files that are explicitly included in the project, but when it is on, we see everything. This makes it very easy to explicitly opt a file into the project without doing an add -> existing item -> find existing item in directory structure and add to project.
The default when creating a new Visual Basic application in Visual Studio is to not show all files, and unfortunatly there is no setting you can adjust to change that.
Open the code file, and in the top-right corner of the code window is a drop-down containing all methods. Open this and select "InitializeComponent".
A screenshot from a newer version. Visual Studio 2015 and 2017 will look like this.
I was happily using VB.NET, saved, and, well, there was a blackout.
Probably lucky? Well, now I open my project just fine, double click the Form1.vb and.... "There is no editor available for ../Form1.vb, make sure the application for the file type (.vb) is installed."
.......... Did something go wrong with my project? Is it dead?
Windows 7, Visual Basic 2010 Express.
What should I do?
The same thing just occurred to me but I couldn't get it fixed trying the previous answers. For some reason, one of my references Microsoft.Office.Core had a yellow exclamation point on it.
Simple Solution
Solution Explorer
Expand References
Right click on the item with "Yellow Triangle w/ "!" point"
Select "Remove"
Open the "Build" Menu at the top
Select Rebuild "filename"
Once this was done, I could open my forms correctly.
It's difficult to imagine what you're seeing. I've seen plenty of cases where the design view won't open for whatever reason, but I've never been unable to view the code for the form.
First thing to try is navigating to your project folder in Windows Explorer, right-clicking on the Form1.vb file, and trying to open it in Notepad. This is pretty much the ultimate test. If you can open it in Notepad, your work is salvageable. If not, the file is corrupted and your best bet is to start over. I suppose if you really feel that you have a lot invested, you could try various file recovery techniques, but considering it's a single form file, I seriously doubt it's worth the time or expense.
If that succeeds, and you can open the file in Notepad, select all the code and copy it to the clipboard. Now go back into Visual Studio, and add a new Form to your project. Delete everything in the new form's code file and paste the salvaged code from your original form back in. You still won't be able to open the form in the designer though, and you'll likely be missing references to all of your controls. Ignore all those squiggly underlines for now.
To fix that, you need to go back to Windows Explorer, and find a file named Form1.Designer.vb. This is the partial class that the designer saves information into; it contains declarations for all of your controls and the properties you set for those controls at design time. Just as before, right-click on this file and open it in Notepad. Select everything and copy it to the clipboard. Now go back to Visual Studio, and click on the "Show All Files" button at the top of the Solution Explorer (hover over them to read the ToolTips). You'll see a bunch of extra junk show up, but what you're primarily interested in are the drop-down arrows that just appeared to the side of every Form class. Expand the new form you added in the previous step, and find it's .Designer file. Delete everything that's in there now, and paste in the code from your salvaged form's .Designer file.
You now have an exact copy of your old form in your project. You can delete that old, corrupted form file, because you're no longer using it. You'll also probably want to change the name of the new file itself by right-clicking on it in the Solution Explorer—right now, it's named Form1 just like your old form, because it's an exact copy of that form. The code says it's name is Form1 and couldn't care less about your file name. Clean and rebuild your project, and if things go your way, everything should be back to normal.
Windows 7/ Vista:
Try right clicking the .vb file and selecting the "Previous versions" tab. When the list has loaded (if it has) select the most recent file from the list and select "Restore". Now reload your project, try doing this with all of the form files, e.g. "Form1.resx" and "Form1.designer.vb" and "Form1.vb" and then reload the project.
It implies that the file is corrupted.Replace an uncorrupted copy of that file in the corresponding directory and then try.
I had the same problem and it was from a bad reference to Excel caused by copying the project from a Win7 machine to a Win8 machine probably.
Open the solution explorer and expand the references You will see two references with the yellow exclamation mark icon beside them indicating a problem - Microsoft.Office.Core - Microsoft.Office.Interop.Excel Right click on both these icons and click remove Your form should load now, if not, save the project, close it then reopen it.
i have this problem too . when i restart Visual Studio the form create successfully and show it's designer.
I've created the Form with a different version of VS, other than 2012 (eg VS 2010, VS 2013, VS 2015; I've used VS 2015). Save the Form in the solution, open the solution with VS 2012 and include the form in the solution. It worked for me.
To fix the problem you need :
1) NotePad++
And you should follow this simple steps :
1) Close Visual Studio .
2) Go to the Backup Folder of your VS version usually in : "C:\Users(your user name)\Documents\Visual Studio (year)\Backup Files\your project or application name" .
3) Open the last Backup file of your corrupted file , usually the name format is : "Recovered-month.-day-year-time.(Your File Name).cs" with NotePad++ , and copy the source code .
4) Go to your corrupted file in the project folder and open it with NotePad++ , Edit => Select All => Past the source code and Save .
5) Go to windows start list and search for : "Visual Studio Tools" folder , open it and double click on : "Developer Command Prompt for VS(year)" .
6) Write this two codes in the Developer Command Prompt : "devenv.exe /setup" and then "devenv /resetskippkgs" .
7) Open your project .
Note : if this didn't work for you try to do the steps before in this arrangement :
1) => 2) => 3) => 4) => 7) => 1) => 5) => 6) => 7)
and your problem will be fixed .
It works 100% for me , i hope this will helps you
Try changing the security permissions on the form affected. Right click the file, go to properties then security and change the access ability to everyone.
How can I stop VS2010 showing errors in .sql files, attached to a project? I don't want to check them at all, just C# code. The files are used as resources, Build Action set to Content. I'd like to keep .sql extension for syntax coloring purpose.
Regards,
Looks like your question was answered here: https://stackoverflow.com/a/8593877/2798869:
Visual Studio 2010
Tools -> Options -> Text Editor -> Transact-SQL -> IntelliSense
Uncheck "Enable IntelliSense".
Visual Studio 2012 & 2013
Tools -> Options -> Text Editor -> SQL Server Tools -> IntelliSense
Uncheck "Underline errors"
Note that you have to close then re-open any .sql files you may have open.
In VS 2012.
Go to the sql file properties in VS.
Under "Advanced", change the "Build Action" option to "None".
Unfortunately you have to do this for each sql file in the project.
This is what gave me the behavior that I wanted. It not only compiles without errors but shows no sql related build errors.
Update
It is possible to select multiple files in Solution Explorer by using Shift + Click (select the file at the top of the list -> hold down shift -> click the file at the bottom of the list). Once you have selected the group of files, you can then change the Build action to None for all of them at once. (This worked for me in VS2013.)
While you still have to select files per folder you don't have to select each file to set the property.
VS2015
right click in editor of the sql file > Intellisense Enabled
May be a sledge hammer to the problem but I manually deploy my SQL changes and only use them to house the scripts for my builds, so I do not need the functionality provided by SQL Projects.
Open the VS Solution File properties (right-click the solution in VS Solution Explorer and select Properties) and in the left pane select "Configuration Properties" -> "Configuration". In the right-pane you will see the projects in the solution. Un-check these projects to prevent them from building, this will prevent them from showing errors.
Is it possible you have a .cs extension on those files but it's not shown? I added some .sql files to my project and the compiler is not complaining.
Change the type of files to content and then the intellisense will never try and parse the contents of the files.
I just built a test project with one class file .cs and added one .sql file. It automatically set the build type to content. It built fine like John Fraser said in VS2010, so I changed it to compile, and obviously it failed.
This isn't the answer yet but perhaps the next step is to try and create a new solution, and import a few of the files from the original project to try to narrow down the source of the problem. If it builds then it would tell you it is something about the settings in your project/solution. Otherwise it could also be a VS setting.
Steps to stop showing SQL errors in bulk:
Open the SQL project file which has the .sqlproj extension in a text editor.
Find and replace <Build Include= with <None Include=. (This one has the same effect as right-clicking and changing Build Action to None in the solution explorer.)
The SQL errors should disappear in Visual Studio.
I'm writing a console application in Visual Basic 2008 Express.
I added several text files to my project as resources. Specifically...
I went to my project's "Properties" page and selected the "Resources" tab.
I clicked the "Add Resource" dropdown and chose "Add New Text File".
I entered some simple text and saved the file as "Welcome.txt".
I built the entire solution.
In my code, I use console.writeline(My.Resources.Welcome) to display the text.
If I run my code through the IDE, it works fine.
If I run the EXE that's in the /bin/release folder, the app crashes.
My system logs show the error as "System.IO.FileLoadException".
I have tried setting the properties on the embedded text file to "Embedded Resource", but the result is the same.
Has anyone encountered this issue? Thank you in advance.
Copy Welcome.txt to your bin\release folder.
OR
To make Welcome.txt an embedded resource, right-click either the text file or the bitmap, and then select Properties.
In the Properties dialog box, locate the Build Action property. By default, this property is set to Content. Click the property and change the Build Action property to Embedded Resource.