.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

Packing a Dll to WSP

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :SharePoint
I want to add a Dll into the WSP Package generated by Visual Studio, when I was using the WSPBuilder I just created a GAC folder in project and put the dll inside. How can I do the same thing in VS2010?

View Complete Post

More Related Resource Links

packing an array of float and send them using raw sockets




I need to send a buffer of 20 float values through the net using sockets, so they're picked up by another app. I thought I had it by using 


 private static byte[] SerializeExact(object anything)
      int structsize = Marshal.SizeOf(anything);
      IntPtr buffer = Marshal.AllocHGlobal(structsize);
      Marshal.StructureToPtr(anything, buffer, false);
      var streamdatas = new byte[structsize];
      Marshal.Copy(buffer, streamdatas, 0, structsize);

      return streamdatas;

And then

 var udpClient = new UdpClient();
      byte[] sendBytes = null;

      udpClient.EnableBroadcast = true;
      udpClient.Connect(IPAddress.Broadcast, 4023);
      sendBytes = SerializeExact(pack);
      udpClient.Send(sendBytes, sendBytes.Length);

but found out it does not work (because a float array is not serializable?), is there any other proper way to do it?

thanks in advance.


How to best handle different packing in 32 bit v.s. 64 bit?


I've got some code which uses FDINOTIFICATION (in fdi.h) via interop.  The problem I ran into is that fdi.h sets the packing to 4 for non Win64, which I guess means it's the default (8) for Win64.  What's the best way to handle this on the managed side?  I'm currently doing this:

#if WIN64
 [StructLayout(LayoutKind.Sequential, Pack=8, CharSet=CharSet.Ansi)]
 [StructLayout(LayoutKind.Sequential, Pack=4, CharSet=CharSet.Ansi)]
 internal class NOTIFICATION

But this means that I need two different versions of my assembly, one for 32 bit and one for 64 bit.  I was hoping I could do the following so that a single assembly would work for both platforms:

 [StructLayout(LayoutKind.Sequential, Pack=sizeof(IntPtr), CharSet=CharSet.Ansi)]
 internal class NOTIFICATION

But that didn't work.



ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend