May 2008 - Posts

Deploying asp.net and .net framework 3.5

Whuah it's been a while since my last post. i'm kind of missing in busy ness to no where.

 Actually there are many things that i would like to post but dunno which one and when.

any way,

When deploying asp.net you can use web setup,

or Precompiled first and then copy the precompiled one to your server production

, remember to set the compilation debug=false. to fasten the pages.remove the unnecessary view state.

Pre compiled one remove all your code behind file to a dll in your bin folder

 Be carefull with your assembly though, the version must be exact. You put it on the bin folder as much as you can.or you must make sure it is on the GAC.

 For dotnet framework 3.5, you ought to use the one 197MB size  , it does not download from server

 How if My website has crystal report?

on web setup click presequites and check the crystal report basic, it should include on your setup , be sure to check the radiobutton number2, not the "download from vendor site".

it should appear the crystal report basic vs2008 runtime(CRRedist2008_x86.msi)

Why Always Appear "Could not find assembly Web.extensions 2.0", i''ve remove all the reference and set to web.extensions 3.5/3.6 ?

the key is in your web.config

 

You see the asp or some one up there doesn't know which version to use if you included that way, it means that for every request for extensions 2.0 Forwarded it to new version  3.6

WEB SETUP you rebuild/build and your website have those DBML it will generate failed but without any error/message, from what i read it will be fixed on sp1

 

 

Share this post: | | | |
Posted by cipto with no comments

Invoke Ref parameters

 I've read the peter Ritchie's MVP blog

and come accross the issue that we met if we have a method that accept argument by reference . then we call it by reflection methodinfo.invoke(object,object[] params)

the issue is the params array that we passed did change but the variable "i" which is  our main target remain the same :

class Program

    {

        private const int testValue = 10;

        public static void TestMethod(ref int i)

        {

            i = testValue;

        }

        static void Main(string[] args)

        {

            MethodInfo methodInfo = typeof (Program).GetMethod("TestMethod", BindingFlags.Static | BindingFlags.Public);

            int i = 0;

            object[] parameters = new object[] {i};

            methodInfo.Invoke(null, parameters);

            // original variable isn't updated

            Debug.Assert(i == 0);

            // array element is updated:

            Debug.Assert((int)parameters[0] == testValue);

 

            // copy updated value to original variable

            i = (int)parameters[0];

 

            Debug.Assert(i == testValue);

        }

    }

}

 

To solve this use the Delegate.createdelegate

main function:Creates a delegate of the specified type to represent the specified static method.

http://msdn.microsoft.com/en-us/library/53cz7sc6.aspx

here's the code:

namespace EmitTesting
{

    // delegate for void method that takes one reference parameter

    public delegate void OneRefParameterCallback<T>(ref T value);



    class Program
    {

        private const int testValue = 10;

        public static void TestMethod(ref int i)
        {
            i = testValue;
        }

        static void Main(string[] args)
        {
            MethodInfo mi = typeof(Program).GetMethod("TestMethod");
            var callback = (OneRefParameterCallback<int>)Delegate.CreateDelegate(typeof(OneRefParameterCallback<int>), mi);
            int i = 0;
            callback(ref i);
            Debug.Assert(i == testValue);
        }

    }

}

Share this post: | | | |
Posted by cipto with 1 comment(s)
Filed under: