Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

How to set the PostBuildEvent programmatically

$
0
0

Hi

I'm trying to setup the PostBuildEvent of a C++ project programmatically (from C#) but I'm getting the following exception:

{"The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"}

Here's my code:

private void AddBuildevent(object inputParams)
        {
            ArrayList Inputs = inputParams as ArrayList;
            Project pExisting = Inputs[0] as Project;
            object[] buildEvents = Inputs[1] as object[];
            using (new VMessageFilter())
            {
                VSProject oProj = pExisting.Object as VSProject;
                string buildEvent = buildEvents[1].ToString();
                try
                {
                    oProj.Project.Properties.Item("PostBuildEvent").Value = buildEvents;
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            }
        }




Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>