Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem building assembly for sample C# WinForm app 1

Status
Not open for further replies.

RLMuller

Programmer
Mar 7, 2003
15
0
0
US
I got the following error message after building/running a sample TreeView C# example:

Code:
mscorlib.dll

Additional information: Could not find any resources appropriate for the specified culture (or the neutral culture) in the given assembly.  Make sure "TreeViewCtl.resources" was correctly embedded or linked into assembly "TreeViewDemo".
baseName: TreeViewCtl  locationInfo: TreeViewCtl  resource file name: TreeViewCtl.resources  assembly: TreeViewDemo, Version=1.0.1186.28592, Culture=neutral, PublicKeyToken=null

Offending line #422:
            imageList2.ImageStream = (System.Windows.Forms.ImageListStreamer)resources.GetObject("imageList2.ImageStream");

The problem is no doubt caused by the way I cobbled together the example from the three .cs files (listed below) obtained from
Because I didn't know how to create an assembly to go along witht the sample .cs files, I started by creating a new WindowsApplication project "TreeViewDemo".

I then built three new text files in the TreeViewDemo folder,
DirectoryNode.cs
PlatformInvokeKernel32.cs
TreeViewCtl.cs

and copied/pasted the code from the Web into them.

Finally, using Solution Explorer, I deleted the generated Form1.cs and then added the three .cs files just mentioned.

The project compiled cleanly, but hung with the error diagnostic indicated above. Any suggestions on how to resolve this would be greatly appreciated.
 
Hello,

The mscorlib.dll deals with the Base Class Libraries Core, rather where it recieves the information to attribute for the object. This means that you probably didn't start a new project and simply loaded the cs file. What you will need to do is create a new solution and run it from there it should work fine. Also if you have a beta version of .NET you might want to make sure all of the appropriate references are correct.
If you have some more questions just repost into this article.

Mike
 
Hi Mike,

Thanks for your reply. I created a new solution as follows (BTW, I'm running the release version of VS.NET):
1. I created a blank solution.
2. Then right-clicked solution to add a new C# Empty Project.
3. Copied the sample's three .cs files to the proj. folder.
4. Right-clicked the project and added the existing .cs files
5. Right-clicked the project's References and added references (Component DLLs)
6. Built the app with no error
7. Ran the app with one anomaly: the app is really a WinForm but ran as a Cmd app, with a command window opened behind a Windows Form.

I selected an empty project rather than a WinForm project because I chose the latter last time, deleted the generated Main1.cs, and encountered the runtime error.

Is there I way I can tweak the project I've just built so it doesn't open that Command window?

Or is there a better way to incorporate sample .cs files into a project?

Again, thanks for looking into my problem.

Regards,
Richard
 
Mike,

I found the tweak: I modified the OutputType from "Exe" to "WinExe".

Now I feel a little bit smarter :)

Regards,
Richard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top