|
For one, don't use automatic versioning (i.e., using an asterisk (*) in your AssemblyVersionAttribute ). Fix your version numbers using a versioning schema to your liking. Version numbers on .NET assemblies actually mean something unlike version numbers for Win32 executables. If a two Types differ only by version numbers, they are not the same Type.
If you're going to install into the GAC, you have to sign your assembly (which you should do anyway - there's never an excuse not to). Use sn.exe -k KeyFile.snk to generate a key pair named KeyFile.snk (or whatever you want to call it) and set the path in your AssemblyKeyFileAttribute , or install it into a CSP using sn.exe -k KeyPair.snk MyKeyPair and use that name ("MyKeyPair") in your AssemblyKeyNameAttribute . I recommend using the same key pair for all your assemblies, or at least all your assemblies for a particular product.
You don't need to uninstall these as the GAC allows for side-by-side versioning of assemblies. If these assemblies are changing often, however, I recommend that that you don't install into the GAC and make sure you set up a Project reference - not a simple assembly reference - in your multi-project solution so that Project B has a dependency on Project A - not Project A's assembly. This keeps versions and builds of assemblies in sync and you should not have the problems you're having (unless something else is causing it, of course).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Excellent! Thanks a bunch for all the info. I will definitely plan on doing all of this (probably won't use the GAC, but WILL strongly name my assemblies).
I have indeed solved the problem with the designer (problem in original post), but see that I have some work to do in configuring my projects/assemblies.
One last question... you mention setting my version with the AssemblyVersionAttribute . That is fine, but this project will have 20+ assemblies once it is complete. I don't want to have to go into each assembly and update the build number for every "internal" build (about once every 3 days) and for each release of the project. Is there a good way to make that happen dynamically? (ok, now that I think about it, I should probably search the site for an article...)
Anyway, thanks again! You've been a real help.
~Steve
|
|
|
|
|
You won't really find any articles on this.
I manage a project with over 60 assemblies (it's a massive N-tier application with several alternative tiers and utilities). Automatic versioning was a nightmare. I quickly threw that out and went with a simple approach.
The major and minor version numbers don't change very often at all. The build number (the third number) is the number of days since Jan. 1, 2000 (wrote a simple program to calculate that) for the milestone. The revision is incremented for any changes done between milestones that must be published into the test directories.
See, the assembly version is really most important when you deploy your assemblies. Since one alternative tier of our application uses touchless dpeloyment over the Internet, Fusion (part of the assembling binding in the .NET Framework) downloads and caches assemblies based on their version number into the Temporary Assembly Cache (also allows for side-by-side versioning). If you fixed a bug and re-released an assembly with the same version, it may not be downloaded to clients who got the first one. That's when changing the versions is most important. You really don't need to change it in between builds when just testing on your machine.
This also causes massive nightmares when you use late-binding, i.e. instantiating Types using .NET reflection (like Activator.CreateInstance ; building plug-in style applications or using the provider pattern). You can use publisher policies (specially named assemblies, roughly) and/or the assemblyBinding section of the .config file to redirect assembly versions.
you should read Redirecting Assembly Versions[^] in the .NET Framework SDK for more information if you're interested.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hmmm, well you've definitely caught my attention. I've been developing C++ for some time now, but this is my first go at .NET. I'm quickly learning that I have a ton to learn.
Thanks for the lesson (and the link). I'll start doing my homework now
~Steve
|
|
|
|
|
I am currently developing an asp.net application that develops crystal reports using the push method. What I am wondering is if I can allow the user to specify sort options during runtime while they are viewing the report information in the .asxp page? For instance I have a report that displays three bits of information about a part(PartNumber,RevisionNumber,CallNumber). I am wondering if I can allow the user to switch between sorting the records by these given fields and just have the page reload with the same data in the newly selected sorted order. Thanks in advance for any help
Frank Lepkowski
PS Sorry if this is not posted where it should be I was not sure were to stick the post!
Live today like it's the last day of your life..........
|
|
|
|
|
Yes you can specify which fields to sort, and there is, IIRC, even an example in the CR for .NET (not C# .NET - any .NET language unless the CR assemblies aren't CLS-compliant, but that only rules out crappy languages like JScript.NET).
There are several ways you could do this. You could specify a grouping in your report that accepts parameters. There are several ways to pass those, which are documented in the CR documentation. For example, you could set parameters using the ReportDocument.DataDefinition property.
You could also design the report to use an ADO.NET DataSet , which would give you maximum flexibility since you could sort and filter the DataSet and then set that as the report data source using ReportDefinition.SetDataSource .
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My reports have been reporting off of ADO.NET datasets the whole time, this will be perfect I can just sort the dataset before i set the report source!
Thanks Heath
|
|
|
|
|
How would I go about creating a Properties file for the Tab Control ?
|
|
|
|
|
A "Properties file"? Please explain a little more.
If you're talking about displaying the properties for a file, then use P/Invoke the shell helper API, SHObjectProperties :
[DllImport("shell32.dll", CharSet=CharSet.Unicode)]
private static extern bool SHObjectProperties(
IntPtr hWnd,
uint dwType,
string szObject,
string szPage);
public void ShowProperties(string filename)
{
if (filename == null) throw new ArgumentNullException("filename");
if (File.Exists(filename))
SHObjectProperties(this.Handle, 2, filename, null);
} This would only work on Windows 2000 and newer, since SHObjectProperties is only supported in newer versions of shell32.dll. There are other ways to accomplish what this helper API does, but you need to understand the shell APIs and PIDLs.
If you want to add a property page to a file's property sheet, you need to implement the unmanaged interface IShellPropSheetExt , among other interfaces, which means you have to declare managed interfaces, implement them, and register your .NET assembly as a COM server. There are several articles about how to do this here on CodeProject.
If neither of these is what you mean, then you should define what you mean by "Properties file" because that's very vague and not technical at all.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
My apologizes for not explaining further. I want to create a properties file, that when invoked creates a Tab Control and sets its properties. I want to do this programatically not via the properties tool bar, in the Visual Studio.net environment. Thanks for your response
|
|
|
|
|
That still makes absolutely no sense. You can't invoke a file for one thing. You can read it, write it, delete it, copy it, and otherwise modify it, but you can't "invoke" a file.
And what "properties tool bar" are you talking about? You mean the PropertyGrid?
If you're talking about creating controls programmatically from information in a text or binary file, there are several ways of doing this. One is from Marc Clifton who's basically modeled his framework after XAML - the XML dialect for Windows "Longhorn" to create applications (not the only way, mind you). See MyXAML--XAML-style gui generator (added styles)[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I guess i cannot Technically explain it. I was looking for something along these lines :
BackgroundSkin=???.bmp
NumberofTabs=2
Tab1Name=Mike
Tab1Pict = ???.bmp
Tab2Name=Jen
Tab2Pict=???.bmp
etc
|
|
|
|
|
Yeah, and the article I linked is one way to do that.
Basically, if you want to read properties from a file you need to parse the name/value pairs and use reflection to assign properties. This typically means you need a file structure that also dictates what those properties (like the ones you have above) apply to. To have a file for every control is absurd. With Marc Clifton's port of XAML (MyXaml), he does just that through XML hierarchies. You should take a look at it.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Can't find a search button for these forums, only the articles. I'm sure there is a wealth of info in the forum database ...
~Steve
|
|
|
|
|
Its to the top right of where the comments start. Click here[^].
#include "witty_sig.h"
|
|
|
|
|
Near the top of each forum is a "Search Comments" link.
"You can have everything in life you want if you will just help enough other people get what they want." --Zig Ziglar
The Second EuroCPian Event will be in Brussels on the 4th of September
|
|
|
|
|
Beat ya to it! :dances around room waving arms in the air:
#include "witty_sig.h"
|
|
|
|
|
|
Just below the code project logo
or
you can use this link
http://thecodeproject.com/script/comments/search_comments.asp?forumid=1649
Sreejith S S Nair
|
|
|
|
|
I'm developing this app that allows users to add controls that represent tasks by clicking a button. When the button gets clicked, a new TaskControl is created and added to the TaskPanel container.
The TaskControl has a DockStyle.Top. However, when the button gets clicked again to add another TaskControl, the new TaskControl gets added to the TaskPanel above the existing TaskControl(s). I want it to appear below the already existing controls.
How do I go about doing that?
|
|
|
|
|
Try calling .BringToFront() on the control you want at the top. Docking orders depend on the Z order of the controls. Play around with the BringToFront and SendToBack methods.
#include "witty_sig.h"
|
|
|
|
|
They are already displayed "on top", but the problem is that new controls push the old ones down (not on the z-axis, but on the y-axis). So I see 'em all, but like so (crude lineart )
------------------------------------
| container | <-- new one gets inserted here and pushes existing down
| -------------------------------- |
| | control | |
| | | |
| -------------------------------- |
------------------------------------
|
|
|
|
|
//Ok your requirement is to add your task control just beneth to the existing task control when //you click the add button.
//for eg : if this is your location value of panel control
this.yourpannel_control.Location=new System.Drawing.Point(8,0);
//then
//assign to public variable LocX and LocY (forgetting x and y co-ordinates values)
//initial values of LocX and LocY
this.LocX=yourpannel_control.Location.X;
this.LocY=yourpannel_control.Location.Y+32;
//(i gave 32 . you can give any number. based on this value your task control will add from top)
buttion_click()
{
if(_UCtl1==null)
{
_UCtl1=new yourtask_control()
this._UCtl1.Location = new System.Drawing.Point(LocX, LocY);
this.yourpannel_control.Controls.Add(_UCtl1);
}
else
{
_UCtl1=new new yourtask_control()
this._UCtl1.Location = new System.Drawing.Point(LocX, LocY);
this.yourpannel_control.Controls.Add(_UCtl1);
}
LocX=LocX;
LocY=LocY+32;
yourpannel_control.Height=LocY+16;
//(i gave 16. you can give the height of your task control + difference between two task control)
}
this code will add your task control just one beneth the other.
|
|
|
|
|
I want to write an if statement that will write the word "error" on a label when the backcolor of a certian textbox is yellow. This is what I tried.
if (textBox1.BackColor = Color.White)
{
label1.Text = "yellow";
}
When I tried this I got a error that said
" Cannot implicity convert type 'System.Drawing.Color' to Bool"
What do I need to do to make this work?
Can I do this?
|
|
|
|
|
Use "==" and not "=" when doing comparisons.
"=" is for assignments and "==" is the equality check.
Cheers,
Simon
sig :: "Don't try to be like Jackie. There is only one Jackie.... Study computers instead.", Jackie Chan on career choices.
article :: animation mechanics in SVG blog:: brokenkeyboards "It'll be a cold day in Hell when I do VB.NET...", Chris Maunder
|
|
|
|