locked
Accessing a dll from WebMatrix RRS feed

  • Question

  • User2117521848 posted

    Hello,

    Last year I developed a Web Matrix web site - it worked very well. The product included a rich API implemented in file named Functions.cshtml in the APP_CODE folder. During the year I found myself wishing that I could take all the functions and create a dll, which could then be accessed from my Web Matrix code and a console app (needed for some scheduled operations). I turned the functions into a single c# file and built a dll in a Visual Studio 2015 project. I then copied the dll into the bin folder in my Web Matrix project and removed the functions.cshtml file in the APP_CODE folder.

    I now cannot reference the functions in the DLL from my Web Matrix project. Here are the first few lines in the source code which is used in the dll:

    using (LOTS OF STUFF...)

    namespace FTFFLibrary {    

        public class FTFFFunctions

            {

                public static int FTFFInitialize ()

                {

                     int retstatus = 0;

                     WebSecurity.InitializeDatabaseConnection("FTFFSite", "UserProfile", "UserId", "Email", autoCreateTables: true);

                     return retstatus;

               }

    I added @using FTFFLibrary; in any CSHTML file that accessed these functions - no complaints about these statements. The inline code reference was (as an example):

    string currentleaguename = FTFFFunctions.FTFFLeaguesCurrentGet (WebSecurity.CurrentUserId);



    The error message is: CS0103: The name 'FTFFFunctions' does not exist in the current context.

    ??? Please ?

    Thanks Rich

    Tuesday, May 2, 2017 7:11 PM

Answers

  • User-2057865890 posted

    Hi Rich,

    The error message is: CS0103: The name 'FTFFFunctions' does not exist in the current context.

    Check file properties, set Build Action to Compile.

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 3, 2017 6:10 AM

All replies

  • User-2057865890 posted

    Hi Rich,

    The error message is: CS0103: The name 'FTFFFunctions' does not exist in the current context.

    Check file properties, set Build Action to Compile.

    Best Regards,

    Chris

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, May 3, 2017 6:10 AM
  • User2117521848 posted

    You are the man, Chris - that solved the problem.

    Wednesday, May 3, 2017 3:00 PM