|
I never tried, but as of my understanding,
The Solution file ( *.csProj ) contains the sections to add reference
under ItemGroup tag these references are listed. This tag supports condition attribute.
So you can write a custom task, which executes under target BeforeCoreGet and sets the condtion attribute of reference ItemGroup accordingly.
Try to search for CustomTask for MSBuild, you found many pre built tasks contributed by communities.
Regards,
Vythees
Miles to go before sleep...
|
|
|
|
|
Wow thanks alot. I found this web site which shows that you can have a condition where if the build is set to a certain type then you can include or exclude references. Then in the build I can define something like UsingThirdPartyControls and in my code I can place #if UsingThirdPartyControls #endif.
I think this could work. Thanks alot.
Chris
|
|
|
|
|
I have an object graph that abstracts the operation of a machine. It will calculate paths, so there are several large lists of points. Currently I am using Zedgraph to plot these lists.
Originally I was using Zedgraph's PointPairList for these points. Everything worked OK. But it didn't seem proper to be so closely coupled to Zedgraph.
As an interim solution I have created PointPairLists that are identical to Zedgraph (but in my own namespace). I am having trouble casting these to Zedgraph PointPairLists. (I was hoping to avoid having to iterate through these rather large lists.)
Here is my question: Is there an elegant solution? Any helpful references or search terms would be helpful. (I did find an MSDN reference to writing custom casting operators.)
I feel like I am missing something obvious.
Thank you-
Squeak
|
|
|
|
|
So let me get this straight - you're using ZedGraph to graph some data, and you don't think that an internal ZedGraph structure should be so closely coupled to ZedGraph?
My advice is to stop over-analyzing it. If you don't, you'll never finish the application.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Zedgraph has a definition as follows:
Ourcompany.PointPairLists points = value;
<pre>
When you "code the exact same thing" you change the namespace so you have an object that is actually:
<pre lang="cs">
Mycompany.PointPairLists;
Unless you explicitely inherit Ourcompany.PointPairLists you will never be able to cast to the object type that they are requesting.
The product probably has a domain uniqueness that using their collections is the only choice. You may also find, if the company is sharp, that they have coded the objects so that they are not inheritable which stops you from encapsulating them as well.
|
|
|
|
|
Hi,
Sorry if this is too basic, Can you please let me know how to typecast string to char* in C#? I need this as Im calling a managed DLL function.
Thanks
Vikas
|
|
|
|
|
Do you mean char[] ?
string s = "abc";
char[] c = s.ToCharArray();
|
|
|
|
|
|
"Managed" ???
Do you want to use pointer in managed environment ???
|
|
|
|
|
Actually from C# I'm calling an unmanaged MFC DLL.
MFC DLL has an API for example:
<br />
int fnSetMonitorNo(char* m_MonitorNo)<br />
int fnGetMonitorNo(char* m_MonitorNo)<br />
If I pass char* to the DLL, it will see the MonitorNo. I tried to do in C# as follows
[DllImport("OfficeCTE.dll")]<br />
public static extern unsafe int fnSetMonitorNo([MarshalAs(UnmanagedType.LPStr)]string arg1);<br />
<br />
[DllImport("OfficeCTE.dll")]<br />
public static extern unsafe int fnGetMonitorNo([MarshalAs(UnmanagedType.LPStr)]string arg1); <br />
But it didn't work.
How can this be done?
|
|
|
|
|
Vikas K. wrote: Im calling a managed DLL function
I don't think that you will be using pointers much in managed environment.
Vikas K. wrote: string to char*
If you want to call some native C++ functions you can use Marshal.StringToHGlobalAnsi[^] method.
*jaans
|
|
|
|
|
hi
i want to detect sql server instances on the system, i was use System.Data.Sql.SqlDataSources
it was work correctly, but does not detect local or default instances, i want to detect it by wmi(like sql server 2005 configuraion manager), but how to do ?
thanks
|
|
|
|
|
Hi all,
I have one resource file and i want to update and delete the content from the resource file programetically, but when i update the resource file thru one form then it will insert the new record rather than update. Below is my code.
ResXResourceWriter w = new ResXResourceWriter("ResXForm.resx");<br />
w.AddResource("test", "test123");<br />
w.Generate();<br />
w.Close();
And when i insert the record programetically, at that time it will insert the record, but it will overright the previous record. how it is possible ?
Rana Krishnraj
|
|
|
|
|
So let's see here ... you execute an AddResource and yet you cannot figure out why it is ADDING the record instead of updating????
I suggest you find another career or go back to school. But if you insist on remaining a programmer, then I just gave you the clue to your answer.
|
|
|
|
|
Hey,
i know i use addsource but u know what happen is ??
suppose i have 4 records in my resource file and when i add new record programetically at that time it will erase previous 4 records and add new i records so right now i have only one records in my resource file. so understand it will not append the records.
i know its my mistake in asking question but from now do not use this kind of words ok..
and if u don't know then do not reply with this kind of words understand.
Rana Krishnraj
|
|
|
|
|
The very, very basic process of changing an element in an array:
resource["text"] = "test 123";
|
|
|
|
|
Doing a little googling I find that you have done two things wrong.
First you defined your FileStream wrong. You have it set of Create or Open and do not have it set for ReadWrite
Next you are only using AddResource for everything. Look at AddResourceData.
If none of those help then you are SOL. And while you may not like what I say, I do not like jobs stolen by cheap Indian labor and then having the same job theives coming here begging us to write their code for them or help them become programmers.
|
|
|
|
|
OK Now don't explain me in air ok. Doing a little googling is not enough ok and one more thing when u make an object of ResXResourceWriter and after that try yo find object's associated methode. there is no any kind of methode that u specufy - AddResourceData() understand u SOL.
any way i already implement it. From now don't reply to any body with this kind of words understand u Bhenchode..
Rana Krishnraj
|
|
|
|
|
|
protected void btnright_Click(object sender, EventArgs e)
{
ListItemCollection listnameitems = lstboxnames.Items;
foreach(ListItem itmname in listnameitems)
{
if (itmname.Selected == true)
{
lstboxphone.Items.Add(itmname.Text);
listnameitems.Remove(itmname);
}
}
}
this is my code to select list box items of one listbox to other listbox.the items must get removed from the listbox where the items are added from.
The add method is working but when i remove the items it is showing a msg box with "collection was modified enumeration may not execute ".
Can any one help where iam doing mistake.
|
|
|
|
|
Exactly what the error says. You cannot modify a collection you are using foreach on. So, you need to use a for loop, or you need to collect items to modify and modify them outside the loop.
List<ListItem> remove = new List<ListItem>();
foreach(ListItem itmname in listnameitems)
{
if (itmname.Selected == true)
{
lstboxphone.Items.Add(itmname.Text);
remove.Add(itmname);
}
}
// now iterate over remove, and remove them.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
does i need to include any namespaces?
The type or namespace name 'List' could not be found (are you missing a using directive or an assembly reference?)
foreach statement cannot operate on variables of type 'System.Web.UI.WebControls.ListBox' because 'System.Web.UI.WebControls.ListBox' does not contain a public definition for 'GetEnumerator'
the above errors are listed when i execute code using ur reply.thanku
|
|
|
|
|
its ok i have done with for loop.
but if any other answer using for each reply me.
Thank u
|
|
|
|
|
System.Collections.Generic. VS2005 will show you missing namespaces, just put the arrow near the bottom right of the word and an arrow appears, which will add a using statement or scope it explicitly for you.
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
There's a much more elegant way to do this if the collection has RemoveAll
listnameitems.RemoveAll( delegate(ListItem itemName) { return itemName.Selected; } );
This avoids creating a temporary list, adding items to it and then iterating over it and removing items from the original list.
|
|
|
|