brett.burkhart Posted June 10, 2009 Report Share Posted June 10, 2009 So I can't find any documentation about hwo to set up a VS solution so that 1) a licensed developer can compile and use the designer, 2) deploying via Click Once to user's machine will allow the charts to run. This seems simple and standard, but it just not working for deployment and for some developers with valid keys. Right now we're have some issues with Click Once publishing to a user's machine. The app gets published just fine, but when the user runs the app they get a message in the chart saying the license has expired. Also, we used to have the trial version installed. Some developers are on XP, some are Vista, and the build machine is Windows Server. After uninstalling the trial version on my XP box, I installed the RTM version. Everything worked fine. A developer with Vista uninstalled the trial version, installed the RTM version, used a valid developer license key, the install worked fine and he can compile and run the app, but the charts show the expired license error. Our VS solution is set up with the WPF application project as a basic shell, no references to ChartFX assemblies, only the GUI projects. We then have other VS project(s) that contain all the visuals, and also contains the reference to the ChartFX.WPF assembly, set to copy local. That same project also has a licenses.licx file with a valid entry. Also, what does Priority Support get me? And where do I include my invoice number as mentioned in the email? Quote Link to comment Share on other sites More sharing options...
JuanC Posted June 11, 2009 Report Share Posted June 11, 2009 Chart FX for WPF uses the built-in licensing support in .NET, this means the following - At design time, when you drop a chart using the toolbox, VS will add a line into licenses.licx that references our assembly - When building, VS will embed a license string into your executable as a resource - At runtime we invoke LicenseManager.Validate in our constructor which will give us access to the embedded string - Unfortunately .NET needs reflection permission to get this resource, you can verify this by creating a dummy XBAP, add a chart and leave the default Internet zone. It results in the following exception System.Windows.Markup.XamlParseException: Cannot create instance of 'Chart' defined in assembly 'ChartFX.WPF, Version=8.0.3150.0, Culture=neutral, PublicKeyToken=a1878e2052c08dce'. The type of the first permission that failed was: System.Security.Permissions.ReflectionPermission at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) at System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) at System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) at System.Activator.CreateInstance(Type type, Boolean nonPublic) at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) at System.Activator.CreateInstance(Type type, Object[] args) at System.SecurityUtils.SecureCreateInstance(Type type, Object[] args) at System.ComponentModel.LicenseManager.ValidateInternalRecursive(LicenseContext context, Type type, Object instance, Boolean allowExceptions, License& license, String& licenseKey) at System.ComponentModel.LicenseManager.ValidateInternal(Type type, Object instance, Boolean allowExceptions, License& license) at System.ComponentModel.LicenseManager.Validate(Type type, Object instance) at ChartFX.WPF.Chart.Init() at ChartFX.WPF.Chart..ctor() You have a couple of options 1) Setting your app to run with FullTrust or create a Custom zone where you add Reflection to the permissions in the Internet zone (FileDialog, IsolatedStorage, Security, UI, Media and WebBrowser) 2) If this is not possible you can contact us and we can provide a license string you can use with the static Chart.SetLicenseString method. If you are already using method 2, you might need to contact us again for an updated license string, as the one you are using might have an expiration period. If you were developing a full trust app (method 1) that used to work, it might be that VS is using a cached license resource, try copying the contents of licenses.licx to a separate file, compile your app, then repaste the string and recompile again. Creating a brand new full trust XBAP might help us know if in fact you are experiencing a problems with VS caching the old license. Regards, JuanC Quote Link to comment Share on other sites More sharing options...
brett.burkhart Posted June 12, 2009 Author Report Share Posted June 12, 2009 OK, couple things, I guess I should've been a little more specific on our set up and what I need. Our VS solution is set up as a fat client application, not an XBAP. What I need is documentation for deploying a WPF Application with Click Once. The problem I'm having, or not having, is the application works on my box because I have the developer key installed locally. What is not working is running the application on other user's machines who do not have ChartFX installed, which they shouldn't. Here's what I'd like to see in documentation to help us deploy, a simple "hello world" application set up like, which is similar to our setup, using ClickOnce. SLN Project1 (application) Window1.xaml (uses ChartControl on the page) Project2 Properties licenses.licx References ChartFX.WPF ChartControl.xaml (has ChartFX Chart control within UserControl) What happens now, for me, this setup works fine. When we use ClickOnce to deploy, users get the "invalid license" message. Do we need a reference to ChartFX.WPF and the licenses.licx in the "Project1" project, which is the WPF application project?? Doesn't seem like you do since Project2 is set to Copy Local. ?? Also, I tried removing the licenses.licx file, then dragging a new Chart control into the designer. That worked fine, VS replaced the licenses.licx. However, it still works for me because I have ChartFX installed locally. I'll have to test ClickOnce deployment to verify, but I'm guessing it won't fix the issue. Thanks, Brett Quote Link to comment Share on other sites More sharing options...
JuanC Posted June 12, 2009 Report Share Posted June 12, 2009 The licensing framework in .NET does not read the license from DLLs, only from executables. In your case you have to make sure Project1 (your application) contains the Chart FX license info. One way of doing this would be to create a dummy Window in Project1 (this window does not have to be shown) where you drop a chart. This will force VS to setup licenses.licx in Project1. Alternatively you can do it manually by adding a licenses.licx file with Chart FX info (and any other licensed component you might be using) and making sure the build options are similar to Project2. Note that is not really that you need to reference ChartFX.WPF in Project1, all you need is for the license info to be embedded in it. The path of least resistance is just to drop a chart but you could manually setup the license without the reference. Again note that the license in Project2 will never be used. JuanC Quote Link to comment Share on other sites More sharing options...
brett.burkhart Posted June 12, 2009 Author Report Share Posted June 12, 2009 Gotcha! Perfect, that makes sense. I'll add the licenses.licx to the EXE project as give it a go. Thanks! Quote Link to comment Share on other sites More sharing options...
MMCCPaulEden Posted July 6, 2009 Report Share Posted July 6, 2009 Hi Could you supply an example of how you would construct the manual license entry? When I add a chart, no license info is added to the licx file and as such does not properly license via an installer. Many thanks Paul Quote Link to comment Share on other sites More sharing options...
JuanC Posted July 6, 2009 Report Share Posted July 6, 2009 If you drop a chart from the toolbox, VS should add the following line to your licenses.licx file ChartFX.WPF.Chart, ChartFX.WPF, Version=8.0.NNNN.MMMM, Culture=neutral, PublicKeyToken=a1878e2052c08dce Also note that when you compile a project that has license info, your output window should look like this C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\LC.exe /target:ProjectName.exe ...C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig ... Regards, JuanC Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.