Jump to content
Software FX Community

Visual Studio setup for Click Once deployment


brett.burkhart

Recommended Posts

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?

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...