Missing Manifest exception Visual Studio 2010 project converted from 2003, 2008 - visual-studio-2010

I have a Win Forms C++ solution that was initially created with Visual Studio 2003, converted to 2008 (successfully) and now I'm attempting to convert it to Visual Studio 2010.
The solution builds without errors then when run I get a missing manifest exception when attempting to load an image list from the resources for a form. The exception happens on the following line of code:
this->m_imageList->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer * >(resources->GetObject(S"m_imageList.ImageStream")));
I think I've found the problem, if I examine the manifest using ildasm of the 2008 assembly I see the following for the resources for the form:
.mresource public SDTP.SDTPDataMonitorForm.resources
{
// Offset: 0x00000000 Length: 0x00006DB0
}
The manifest for the 2010 assembly appears as follows:
.mresource public SDTPnet.SDTPDataMonitorForm.resources
{
// Offset: 0x00000000 Length: 0x00004F57
}
.mresource public '..\\temp\\Debug\\SDTP.SDTPDataMonitorForm.resources' as '..$temp$Debug$SDTP.SDTPDataMonitorForm.resources'
{
// Offset: 0x00008E80 Length: 0x00004F57
}
I'm sure it can't find it due to the extra "net" text in the first instance, and the extra ..$temp$Debug in the second instance.
So finally, my question: Where in the project settings do I fix that? The ..\temp\Debug is part of the project path... Playing around a bit if I change the "Intermediate Directory" setting to just $(Configuration) I now get:
.mresource public 'Debug\\SDTP.SDTPDataMonitorForm.resources' as Debug$SDTP.SDTPDataMonitorForm.resources
{
// Offset: 0x00008E80 Length: 0x00004F57
}
in the manifest file which still generates the exception.
Thanks for any help...

Right click on the .resx file and select properties and edit "Resource Logical Name"

Related

C++ Windows Forms application icon exception

I want to set an icon for my Windows Form application. My actions step by step:
I created an 'icon.ico' (256x256) and put it into my project folder
In my 'Form1.h [Design]' I chose this file using Properties
This code appeared in 'Form1.h'
void InitializeComponent(void)
{ ...
this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon")));
... }
The object '$this.Icon' appeared in 'Form1.resx'
I rebuilt the whole project -> no errors
During execution the line 'this->Icon = ...' causes an exception: System.Resources.MissingManifestResourceException: 'Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "WinForm.Form1.resources" was correctly embedded or linked into assembly "MyProject" at compile time, or that all the satellite assemblies required are loadable and fully signed.'
Here I found numerous advices, such as remove/add icon or set some custom properties for 'Form1.resx', but none of them works for me
Just like above, change line to:
this->Icon = gcnew System::Drawing::Icon(L"ICON_NAME.ico");
You might get error/exception while opening form creator but you shouldn't lose any data.
Been there, done that :)
Place the Icon you want to connect to your Form in the project directory.
Then replace the line above with the following:
this->Icon = gcnew System::Drawing::Icon(L"app.ico");
This should neutralize the bug that Microsoft has not fixed.
If you are using visual studio 2019 , you need to change the name of namespace in Form1 the same as your project name, i did it and it works
and make sure you change it in main :
[STAThread]
int main() {
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Application::Run(gcnew your_namespace_name::Form1());
return 0;
}

Problems with running Xamarin for Visual Studio 2017

Okay, I've been searching and searching and it seems that people have somewhat similar scenarios concerning my problem, however, none of the solutions presented even offer a sound solution. I've recently installed Visual Studio 2017. I went on to test the Xamarin Android Emulator by creating an app (named "Try") with absolutely nothing on it. Mind you, this is a fresh install of Visual Studio 2017 with JDK 1.8.0_152 and Android 7.1.1 (25). Right off the bat, the build failed. I cleaned the solution and tried to build again. Fail.
I kept getting these errors:
Severity Code Description Project File Line Suppression State
Error error: <identifier> expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
_______________________________________________________________________
Severity Code Description Project File Line Suppression State
Error error: class, interface, or enum expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
_______________________________________________________________________
Severity Code Description Project File Line Suppression State
Error error: class, interface, or enum expected
package try.try; Try C:\Users\User\source\repos\Try\Try\obj\Debug\android\src\try\try\R.java 8
Great, so this has to have something to do with R.java 8? I go to the source and get this:
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package try.try;
public final class R {
public static final class attr {
}
public static final class id {
public static final int textureView1=0x7f040000;
}
public static final class layout {
public static final int main=0x7f020000;
}
public static final class string {
public static final int app_name=0x7f030000;
}
}
What is wrong here? I haven't even began to start coding or tinkering with Xamarin yet. Can someone please explain?
Figured it out. I don't know why, but Visual Studio 2017 put those project files in a completely different location unlike previous versions. Usually, it would have been put here: Documents>Visual Studio 2017>Projects>[Project Name]. It seems that the place you put your project is conflicting with Xamarin somehow. My suggestion would be to change the project location to what I mentioned above and then build the solution again. If that doesn't work, make a new project with the specified location and test it out. I had a similar problem and that fixed it for me.

The "VSCTCompiler" task failed unexpectedly with OutOfMemoryException

What I did is:
I created a new VSIX Project from the Extensibility Template.
I added a new Item for ToolWindow1.
Then I compiled and got the message. It is on Visual Studio 2015.
Memory on computer is 8GB and Visual Studio is installed on brand new computer.
The message I got is as follows:
Severity Code Description Project File Line Suppression State
Error The "VSCTCompiler" task failed unexpectedly.
System.OutOfMemoryException: Out of memory.
at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at Microsoft.VisualStudio.CommandTable.BitmapItem.Read(TextReadVSCTCStream s, XmlElement itemNode)
at Microsoft.VisualStudio.CommandTable.ItemList.Read(TextReadVSCTCStream s, XmlElement listNode)
at Microsoft.VisualStudio.CommandTable.CommandTable.ReadCMDSSection(TextReadVSCTCStream s, XmlElement listNode)
at Microsoft.VisualStudio.CommandTable.CommandTable.Read(TextReadVSCTCStream s)
at Microsoft.VisualStudio.CommandTable.CommandTable.Read(String fileName, ReadOptions ro, IMessageProcessor errorProcessor)
at Microsoft.VisualStudio.CommandTable.CommandTable.Read(String fileName, IMessageProcessor errorProcessor)
at Microsoft.VisualStudio.CommandTable.Compiler.Compile()
at Microsoft.VisualStudio.CommandTable.VSCTCompiler.Execute() VSIXProject1
Is there any way out on this?
It seems that the File created by Visual Studio is corrupted. You can check the file yourself in the File Explorer in the Folder "/Resources" (which should lie next to your .csproj file) and try to open it with another program.
To fix the error, replace the file with a valid .png file. For me it worked by creating a new "ItemTemplate" Project from the Extensibility Templates. Then Add Item -> Custom Command.
This created a valid .png, which can be used to replace the corrupt .png file from the VSIX Project.
Solution found here: https://dotblogs.com.tw/rainmaker/2016/08/23/132552.
If you cannot speak Korean, here is the google translation: https://translate.google.at/translate?hl=de&sl=zh-TW&u=https://dotblogs.com.tw/rainmaker/2016/08/23/132552&prev=search

Visual Studio 2010 Not Recognizing Unit Test

In an existing solution I added a new Test Project. In my Test Project .cs file I have a class decorated with the [TestClass] attribute and a method decorated with the [TestMethod] attribute. I have verified that in Configuration Manager the build check box is checked for the Test Project (as my google search has revealed was the problem for others with this issue). I have set Test Project as my start up project for the solution. When I try to start the test I get "Can not start test project because the project does not contain any tests". I am really new to unit testing. What am I missing?
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Whole bunch of stuff
Assert.Inconclusive("Done");
}
}
Update: So I opened a new instance of VS, went to File => New => Project => Test Project. Did not touch or edit anything. Went straight to the cs file and here are its contents in its entirety:
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace TestProject2
{
public class Inspection
{
public bool SubmitInsp()
{
return true;
}
}
[TestClass]
public class UnitTest1
{
[TestMethod]
public void TestMethod1()
{
Inspection insp = new Inspection();
bool result = insp.SubmitInsp();
Assert.IsTrue(result);
}
}
}
Same error about the project not containing any test when I try to start it. Also found this in the build output "Could not load file or assembly '~\my documents\visual studio 2010\Projects\TestProject2\bin\Debug\TestProject2.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)"
I don't know that units tests get much simpler than this. What the heck???
I've had the same problem, when tests in an working test project suddenly weren't recognized anymore.
Comparing the project file with one from another working test project showed me that the <ProjectTypeGuids> node was missing from the main <PropertyGroup> node.
Adding this line inside the <PropertyGroup> node solved my problem:
C#:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
VB:
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
I was able to get this to work by modifying the devenv.exe configuration file found here:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config.
Add the following line to the <runtime> section, then restart Visual Studio:
<loadFromRemoteSources enabled = "true" />
(Here is the link that helped me)
The FrstCBC's anwser did not worked for me.
I am on a VirtualBox machine with Windows 7 64 bits and Visual Studio 2012.
I had to move the output to a local folder : open the unit tests project properties and in the Build tab, browse the Output path to a local folder. The tests are now detected and can be run.
Test Projects saved to a network folder or anywhere locally on my computer have this issue. Created another Test Project and saved it to my flash drive, works just fine. I don't know if it is because my machine is 64 bit or because its a virtual machine or what, but I guess I just need to test everything on external storage devices.
For me it was just that my class and method weren't public (I realize the poster did have public, but I found this post by Googling "testclass testmethod margin icons missing"). Dumb mistake on my part, but maybe it will help others.
Verify that all the .cs files are marked as Compile in the Properties window. If it is marked as Content then you will hit this issue.

Getting started with Watin

I am trying to do the quick start example, I bring in the ref's using NuGet in VS2010, I scrape the sample code on the webpage, I see my NUnit Session window, I click the green arrow, but the browser doesn't get invoked (doesn't start). What am I missing?
using System;
using NUnit.Framework;
using WatiN.Core;
namespace FirstWatinProject
{
[TestFixture]
public class Class1
{
[Test]
[STAThread]
public void SearchForWatiNOnGoogle()
{
using (var browser = new IE("http://www.google.com"))
{
browser.TextField(Find.ByName("q")).TypeText("WatiN");
browser.Button(Find.ByName("btnK")).Click();
Assert.IsTrue(browser.ContainsText("WatiN"));
}
}
}
}
I am getting the following error in NUnit Sessions window;
SearchForWaitOnGoogle Failed: System.IO.FileNotFoundException: Could
not load file or assembly 'Interop.SHDocVw, Version=1.1.0.0,
Culture=neutral etc...
Okay, solved the error, it is as the following other overflow thread concludes;
WatiN System.IO.FileNotFoundException Interop.SHDocVw
BUT, a key action in the sequence is to build the class library project AFTER setting the Interop.SHDocVw dlls' 'Embed Interop Types' property to 'False';
Then you can hit the green arrow in NUNIT Sessions window and you will see the IE browser startup after a second or two. Simply click it and you will see whatever actions you have programmed.
God is in the details!
Setting the Interop.SHDocVw, Microsoft.mshtml dlls' 'Embed Interop Types' property to 'False';
Of course Visual Studio would give you warnings on how to amend.
The Use of Nugget Package Manager
Check for the availability of Interop.SHDocVw.dll,
Make sure that your project has a reference to Interop.SHDocVw.dll and the dll is present in the Bin/Release Folder depending upon how you are running..
Just select Build from the main menu...then select Configuration Manager. In the list select you project and change its Plateform 'Any CPU' etc to x86.
If you have only Only CPU option, you can use ... option when chosing platform and create new setting, that is for X86 platform and then choose it.
ref:
Change target to x86 in VS2010
I already had a reference to Interop.SHDocVw. The easiest fix for me was simply changing .NET from 4.5 to 3.5 in Visual Studio settings. After making the change, it worked fine.

Resources