|
Select the reference under the References node and look at the properties. There is a property to control whether the assembly is copied to the target directory. If the assembly with the same name (name, version, culture, and public key token) is installed into the GAC, you should not copy the assembly to the target folder since the CLR checks the GAC first.
If the property is set to copy the assembly, then check your compiler warnings. Many times a file may be in use and cannot be copied from its source directory (or if the destination is in use, it can't be copied over). The only fix is to restart VS.NET and try again.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Heath,
Thank you for taking time with my question.
All references, as stated in the problem definition, are set to CopyLocal=True, yet indirect dependencies (references of references) are not copied, at least not file references.
Looking at the various projects in my solution, I see the Project references are linked to the 'obj' folder of the referenced project. Now I wonder when dependencies are copied and how they are determined, because this process seems to miss the indirect file references. Interestingly, however, the Deployment projects do a more exhaustive search along the dependency hierarchy because it finds many related files. My solution uses MS Commerce Server and some of the projects have two dozen or so dependencies, most of which don't need to be deployed because Commerce Server is a product pre-installed on the target machines.
While writing this reply, I created a small sample project to illustrate my point. In the sample, App1.exe has a project reference to ProjRef1.dll. ProjRef1 has a file reference to FileRef1.dll (which is not part of the solution) and, naturally, it works correctly. Maybe there's a problem with the size of my solution (30 projects).
|
|
|
|
|
Doubtful - I managed a 60+ project solution for builds, many of which have indirect dependencies.
Again, check your build output window for warnings about files being in use. This is most often the problem.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
Does anyone know what happens with errors and threading?
I have a front-end app that spawns a new thread to call a method in a dll.
This all worked well, job got done, thread closes, everything happy.
OK, so now i've got live data: The app starts, appears to work, cpu drops to zero, but no output, an event that the dll should fire doesn't happen and the thread exited with code 0 message doesn't appear in the output window.
This leads me to believe that an error is occuring in the thread and the thread is vanishing for some reason. I have got error handling in the dll, but probably not enough.
Is there anything special i have to do to get errors passed back out of the thread, there seem to be a lot of web pages talking about threading, but none seem to involve error handling.
Thanks in advance if you can help, point me in the right direction
Russ
|
|
|
|
|
See the Application.ThreadException event documentation in the .NET Framework SDK.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a dataset (theDataSet) that contains three tables. One parent (table1), a child(table2), and a child of the child (table3). I am using dataGrid2.SetDataBinding(theDataSet, "table1" ) to have the tables displayed. This all works well. The problem is, I do not want to allow the user to delete or add rows in table1 and table2. Before I did the SetDataBinding and relation stuff I used a dataView with allowDelete and allowNew set to false. (Thanks for that one Heath ) How can I incorporate a dataView with what I have now.
Thanks in advance
Jenny
|
|
|
|
|
The same as before. Create a DataView over whichever tables you want to change the behavior of and bind those by setting the DataGrid.DataSource property to the DataView s.
If those tables are all related by specifing the relationship between tables as the DataSource , then you'll have to get the DataTable from the DataRelation , get the DefaultView , and then set those properties.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I tried this and it doesn't work. What am I doing wrong?
dr = new DataRelation("Class Limits",theDataSet.Tables["table1"].Columns["NoOf"],
theDataSet.Tables["table1"].Columns["NoOf"]);
dataGrid2.SetDataBinding(theDataSet, "table1");
DataTable pt = dr.ParentTable;
pt.DefaultView.AllowDelete = false;
pt.DefaultView.AllowNew = false;
|
|
|
|
|
Actually, I said if you have related tables being displayed in a DataGrid that you assign the DataRelation as the DataGrid.DataSource . You've created a DataRelation , but you haven't done anything relevant with it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I'm sorry for my stupidity in this matter, but I obviously just don't get it. Can you give me an example of what you are talking about?
|
|
|
|
|
It's all covered in the .NET Framework SDK. For example:
DataRelation("CustomerOrders",
ds.Tables["Customers"].Columns["ID"],
ds.Tables["Orders"].Columns["CustID"]);
dataGrid1.AllowNavigation = false;
dataGrid1.DataMember = "Customers";
dataGrid1.DataSource = ds;
dataGrid2.DataMember = "Customers.CustomerOrders";
dataGrid2.DataSource = ds; Now you're got two related tables. Selecting a row in the Customers DataGrid (dataGrid1) will show related rows from the Orders table in the Orders DataGrid (dataGrid2). See the DataGrid.DataMember for more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My Table "Adressen" has as PrimaryKey "adid".
When I want to update the Adressen Table occurs an error:
Procedure sp_AdressenUpdate expects parameter @Original_adid which was not supplied.
This error occurs only if I edit a row and update, NOT when I add new Rows and update then.
The parameter @Original_adid exists.
I hope you can help me!
Thanks
Stefan
|
|
|
|
|
STW wrote:
This error occurs only if I edit a row and update, NOT when I add new Rows and update then.
Because it's used only in the DataAdapter.UpdateCommand and, thus, must be added to the DataAdapter.UpdateCommand 's Parameters property. The data adapter designer will do this for you if you opt for it.
The exception would not be thrown if the Parameters property contained the parameter correctly - i.e., it's named "@Original_adid" and is declared as the correct type.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I want to create control inherited from UserControl class. I need this control to be scrollable (I‘m using Autoscroll property) and I want to paint its background with linear gradient brush. When I do this and scroll the control it doesn‘t redraw correctly. Can anybody point me to some tutorial, or at least tell me how to get something like OnScrollEvent (I couldn’t find anything like that in the Control class. thanks
Salut!
|
|
|
|
|
Hi,
Could any one share with me the source in C# for adding, updating and deleting data in a SQL server database using ADO.NET.
A simple windows application would be of great help.
Thanks
Saleem.
|
|
|
|
|
The documentation for the SqlDataAdapter Class[^] in the .NET Framework SDK contains plenty of examples and all the documentation you need. Reading the class library documentation in the .NET Framework SDK is important. If you have a question about a specific class (or struct, interface, method, property, etc.), I recommend you read the SDK documentation first.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have written a short piece of code that goes of to a URL and retrieves and XML formatted file. The file that is returned is dicatated by a URL parameter.
If I go directly to the URL in a browser, the XML document is displayed correctly and fully. When I attempt to do this through code the last quarter of the XML string is made up of escaped 0's (i.e. \0)
The code I have is as follows :
string endPoint = "https://myserver/xmlprovider?id=123";
HttpWebRequest samlRequest = (HttpWebRequest)WebRequest.Create(endPoint);
HttpWebResponse samlResponse = (HttpWebResponse)samlRequest.GetResponse();
Stream responseStream = samlResponse.GetResponseStream();
byte[] buffer = new byte[samlResponse.ContentLength];
responseStream.Read(buffer, 0, buffer.Length);
string returnData = System.Text.Encoding.ASCII.GetString(buffer);
responseStream.Close();
Does anybody know what could be causing this?
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
It's either because you're using the wrong encoding (most likely) or because you're trying to buffer way too much.
I remember having this conversation with you before: do not buffer the entire content. Break it apart into smaller buffers. 4096 bytes (4Kb) is typically a good buffer size. Stream it into a file.
The most likely problem, as I said above, is that your encoding is wrong. ASCII characters are 1 byte, where other characters sets range from 1 byte to 4 bytes. UTF8, for example, could be 1 byte or 2 (MBCS). If your response stream is Unicode (UCS-2, or 2 bytes per character), then your byte count would be twice as large as you think it should, and the default byte value is 0 (character '\0').
To get the correct encoding, you should use the HttpWebResponse.ContentEncoding property like so:
Encoding enc;
try
{
enc = Encoding.GetEncoding(response.ContentEncoding);
}
catch
{
enc = Encoding.UTF8;
}
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Here is a sample of a small c# assembly passing a string array
public enum WeatherType
{
Cloudy=0,
Sunny,
Windy
}
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface IWeatherSink
{
//for arrays
string[] WeatherOptions();
[return : MarshalAs(UnmanagedType.LPArray,SizeConst =4)] string[] WeatherOptionsasArray();
}
Now by default,the array is marshalled as safearray ,as confirmed from teh typelib.
Now the second line attempts to marshall the array as LPArray type.
The ATL client invokes these methods as
SAFEARRAY* _safe=cpi->WeatherOptions();
wcstombs(weathertype,(BSTR)_safe[0].pvData,512);
cout << " safearray dimensions " << _safe->cbElements << " " << weathertype << endl;
The invocation of the above is successful.However executing the foolowing
//now receive it marshalled as BSTR* array
BSTR* _bstarray=cpi->WeatherOptionsasArray();
gives the following error
The value of ESP was not properly saved across a function call.
Why is this happening? How should this be invoked
|
|
|
|
|
The ESP register is a stack pointer that is grabbed by the caller and should reference the address of the variable. In this case it is not.
What is wrong with the SAFEARRAY? Simple array pointers should actually not be used in OLE automation, which describes the requirements for OLE clients - a base minimum set of requirements that all OLE-compliant languages/frameworks should follow (kind of like the CLI, only for COM).
That's not to say it's impossible, though. This isn't uncommon with P/Invoke. Because it's a return value, you also don't need to specify SizeConst , which is only used when marshaling from unmanaged to managed code, which does't happen for a return value.
Try this:
[return: MarshalAs(UnmanagedType.LPArray,
ArraySubType=UnmanagedType.BStr)]
string[] WeatherOptionsAsArray();
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I was tryin out the various marshalling options available from managed to unmanaged environmentfor strings and arrays.Hence the adventure of trying to marshall the array as LPArray(as per Andrew Troelsen's book thsi should be possible).
However,the suggestion you gave does not work -it still gives 'The value of ESP was not properly saved across a function call File i386/checkesp.c Line 42'
|
|
|
|
|
i want find a class which can analyse HTTP.
i have the HTTP string,
HTTP 1.0
Connection: keep-alive
Browser: IE40
........
i want input the HTTP string and the class can out put anything i need.
such as System.Web.HttpRequest is very good.but i can't find any method can input string, what class should i use?
|
|
|
|
|
Be patient - you asked this question just a few moments earlier.
Read my response to your previous question.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
When we view any document in print preview dialog, where does it save the document? such that when me move to next/previous page where it reads the information from . If a heavy document like RTF file having images and large number of pages is viewed in PrintPreview, does it affects the system speed? What happens at application level?
please guide
regards
|
|
|
|
|
It's stored in memory, the same as all other objects in an object-oriented application (or even just variables in procedural languages - it's all about memory).
If you have large documents and don't want to buffer them all in memory, then you need to implement drawing routines from cached objects. For instance, if you get an event notificatin that the first page is being drawn, you should have to grab the first page full of what the document contains, leaving the rest on disk (when applicable).
Typically this is not a problem, though. In most applications, when you load a document (Word document, HTML document, Photoshop Drawing document, whatever) the whole thing is loaded into memory anyway. If you draw from that document, then only a single copy is read into memory for both displaying and printing. Certain things can affect this, however.
So, if you make your document class derive from PrintDocument , then you only need to have one reference loaded. When you assign your document object to the PrintPreviewDialog.Document property, for example, a reference is saved - not a copy of the document.
You don't have to derive from PrintDocument , either. Just make sure that any printing routines query your document object for how to print and you can save memory.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|