My situation: Trying to convert a program written in msvc# 2010 Express to run in webmatrix
I. I created an empty website in webmatrix
a. created a Bin folder and added muparser.dll and muparser.lib to it by Right-Click on Bin folder then chose "Add Existing file..."
b. created a App_Code and added muParser.cs to it by Right-Click on App_Code folder then chose "Add Existing file..."
1. the content of muParser.cs
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace muParser
{
//some codes
}
II. Created a empty cshtml file
a. Added @using muParser
III. Error message: Compiler Error Message: CS0246: The type or namespace name 'muParser' could not be found (are you missing a using directive or an assembly reference?)
IV. How do I resolve this?
Thank you for your assistance,
Cha Tre.
V. Edits
Edit 1: 3/4/2012: a. Specify the way to add files into project.
Right-click on the references folder, add reference, and browser to your DLL. This will attach it to the project - copying the file to the bin folder isn't enough.
Could you be more specific? After creating Bin and App_Code folders, I did Right-Clicks on them and chose "Add Existing File..." I didn't see the "Add reference" option at all.
When I create a project in Visual Studio, it automatically has the References folder that you right click on to add more references. When you open the folder, it shows items like Entity Framework, Microsoft.CSharp, System, etc.. Does your project have this?
WebMatrix doesn't have "References" folder, it only has "Bin" folder. All DLLs are supposed to be in "Bin" folder? Any comments/suggestions are welcome.
chatre
Member
21 Points
8 Posts
How to use namespace in webmatrix
Mar 04, 2012 12:41 AM|LINK
My situation: Trying to convert a program written in msvc# 2010 Express to run in webmatrix
I. I created an empty website in webmatrix
a. created a Bin folder and added muparser.dll and muparser.lib to it by Right-Click on Bin folder then chose "Add Existing file..."
b. created a App_Code and added muParser.cs to it by Right-Click on App_Code folder then chose "Add Existing file..."
1. the content of muParser.cs
using System;
using System.Diagnostics;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
namespace muParser
{
//some codes
}
II. Created a empty cshtml file
a. Added @using muParser
III. Error message: Compiler Error Message: CS0246: The type or namespace name 'muParser' could not be found (are you missing a using directive or an assembly reference?)
IV. How do I resolve this?
Thank you for your assistance,
Cha Tre.
V. Edits
Edit 1: 3/4/2012: a. Specify the way to add files into project.
b. Specify the C# name.
bluesherpa
Member
130 Points
48 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 05:13 AM|LINK
Right-click on the references folder, add reference, and browser to your DLL. This will attach it to the project - copying the file to the bin folder isn't enough.
chatre
Member
21 Points
8 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 06:20 AM|LINK
bluesherpa,
Could you be more specific? After creating Bin and App_Code folders, I did Right-Clicks on them and chose "Add Existing File..." I didn't see the "Add reference" option at all.
Thank,
Cha Tre
bluesherpa
Member
130 Points
48 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 06:40 PM|LINK
When I create a project in Visual Studio, it automatically has the References folder that you right click on to add more references. When you open the folder, it shows items like Entity Framework, Microsoft.CSharp, System, etc.. Does your project have this?
chatre
Member
21 Points
8 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 08:26 PM|LINK
WebMatrix doesn't have "References" folder, it only has "Bin" folder. All DLLs are supposed to be in "Bin" folder? Any comments/suggestions are welcome.
bluesherpa
Member
130 Points
48 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 08:35 PM|LINK
Select Add reference from the Project Menu, click the Browse button, find your dll, and click ok.
Here's a page that has screenshots
http://www.carlosag.net/articles/writing-webmatrix-addins
chatre
Member
21 Points
8 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 09:10 PM|LINK
My MS WebMatrix doesn't look like that at all. It looks like in this website
bluesherpa
Member
130 Points
48 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 10:13 PM|LINK
You might be trying to do more than WebMatrix supports. Check out Visual Studio Express.
http://www.microsoft.com/express
GmGregori
Contributor
5564 Points
749 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 10:39 PM|LINK
"The Bin folder is used for managed-code assemblies, not for native-code (unmanaged-code) assemblies" from Shared Code Folders in ASP.NET Web Site Projects.
Is it possible that this is your case?
chatre
Member
21 Points
8 Posts
Re: How to use namespace in webmatrix
Mar 04, 2012 11:12 PM|LINK
Thank bluesherpa and GmGregori. I added unmanaged-code assemblies to the Bin folder
.