Including sqlite.db file in a WPF ClickOnce deployment - wpf

I built a small app with VS 2010 in WPF. I have used to store data in SQL lite. I have bound a dropdown field from SQL lite dataconnection.
When I run this application in VS it was worked fine. And published it as a click-once app.
I have added SQL Lite.db file to application files and it appears in Project Properties ->
Publish tab -Application Files.
I set the file's Build Action to "Content", and in
Application files, set it to "Include".
But still the dropdown field doesn't have any values.

most likely the path to database gets lost. See Accessing Local and Remote Data in ClickOnce Applications - you need to make your sqlite file as Data (not Content as you did), and use ApplicationDeployment.CurrentDeployment.DataDirectory folder as a base folder for it.

Related

Include data files when publishing a WPF App [duplicate]

I am trying to deploy my first WPF, C# application to many desktops. For most records in the case database there is a large PDF which I want to store separate from the database and is displayed when a button is pressed (PDF filename equals the id number). It is a search only program, no data is being saved back to the database by users. There are approximately 32,000 pdfs and this number will grow. When I tried to list these files in the project and use ClickOnce to Deploy VS said I had exceeded the maximum manifest size.
Is there a way to deploy my app with ClickOnce and then copy the files with some type of post-install command? Thank you.
Add the files to your project. Mark the Build Action as Content and the Copy to local directory to Always. Then it will include the files with your deployment.
You can also check the Application Files dialog to see if they are there. And if the files have a file extension of XML or something that indicates data, you want to change the option from Include(Data) to Include or Include(Required). If you include a file as data, it is put in the DataDirectory after deployment.
Select a data file in Solution Explorer.
In the Properties window, change the Build Action property to the Content value
2. To mark files as data files
With a project selected in Solution Explorer, on the Project menu, click Properties.
Click the Publish tab.
Click the Application Files button to open the Application Files dialog box.
In the Application Files dialog box, select the file that you wish to mark as data.
In the Publish Status field, select Data File from the drop-down list.
3. To mark files as prerequisites
With a project selected in Solution Explorer, on the Project menu, click Properties.
Click the Publish tab.
Click the Application Files button to open the Application Files dialog box.
In the Application Files dialog box, select the application assembly (.dll file) that you wish to mark as a prerequisite. Note that your application must have a reference to the application assembly in order for it to appear in the list.
In the Publish Status field, select Prerequisite from the drop-down list.
Source: MSDN - How to: Specify Which Files Are Published by ClickOnce

Templateless Module Development

Throughout the internet documentation for DotNetNuke is far and wide, this in itself is quite useful. However one hurdle exist and I can't appear to solve it. How do you do DotNetNuke Module development without Chris Hammond's Template?
This template has become so widely accepted and utilizes that no other documentation exists.
I've already accomplished the following:
Configured SQL Server Database
Configured Internet Information System (Bindings)
Modified the System32 Host File (For local IP to reflect web-site Name)
Installed the MSBuild Community Task
Installed DotNetNuke Instance
Everything is installed and in place, now I have open DotNetNuke's Site into Visual Studio and configure my project to actually build the module.
I figured if I reference the .dll for DotNetNuke that should suffice, but the Web Forms Project loads all this extra garbage that impacts the development.
Could someone outline the proper way to build your environment from scratch without the template for Visual Studio?
Setup a DNN Development environment, even if you aren't using my templates I recommend the same dev environment approach http://www.christoc.com/Tutorials/All-Tutorials/aid/1
Using Visual Studio create a new Web Application Project, with a location of /desktopmodules/ in your DNN dev environment. (Follow Step 9 of this tutorial http://www.christoc.com/Tutorials/All-Tutorials/aid/4)
Remove everything that Visual Studio puts into the WAP project (folders, web.config, etc).
Add an assembly reference to DotNetNuke.dll in the website's BIN folder
Right click on the Project properties and set properties on the project to have the Build location be the website's BIN folder (../../bin)
Change the web tab have the following properties set
IISUrl:http://dnndev.me/desktopmodules/MODULENAME
OverrideIISAppRootUrl:True
IIS App Root URL:http://dnndev.me
Add an ASCX file to your project. (view.ascx)
Change the BASE class for the ASCX file to inherit from PortalModuleBase
Compile your module
Register the module with DNN (host/extensions)
Add the Module to a page.
TL;DR
Save yourself the trouble of steps 2-8 and 10 by using the template.
Honestly, the best bet if you want is use Chris's template as a base, and edit it to get it as plain as you want it to be.
I have a plain template that only has the MSBuild configuration in it as I don't even have local copies of DNN on any of my development machines.
The key magic pieces of his template is the MSBuild stuff, and I go one step further and use NuGet to manage the packages/references to DNN that way I don't have any other DNN files locally.
This is what I used to do BEFORE I started using a template. Very similar to #bdukes but rather than developing in the DesktopModules folder, I like to keep my modules in their own projects outside DNN.
In Visual Studio, select File -> New -> Project.
Select '.NET Framework 4' from the version dropdown and C# -> Web from the tree pane on the left then 'ASP.NET Empty Web Application'.
Delete the web.config file.
Add a reference to the DotNetNuke dll.
Add a new user control to the project, this will be your main view for your project.
Make sure the user control inherits from DotNetNuke.Entities.Modules.PortalModuleBase instead of System.Web.UI.UserControl.
Build the project in Visual Studio.
Right click on the Project in Visual Studio and select 'Open Folder in File Explorer'.
Copy the DLL of your project into the bin folder of your dotnetnuke instance.
Paste the project folder in your DotNetNuke instances DesktopModules folder.
Delete all files except the user control you created from the folder you pasted under DesktopModules.
Login into your DNN instance.
Navigate to Host -> Extensions -> Create New Module.
Select 'Control' from the dropdown.
Select the module folder (not owner folder) you pasted in DesktopModules.
Give your module a name and tick the option 'Add Test Page'.
Click 'Create Module'.
You will then be taken to a test page with your new module running with only an empty user control. You can then add controls into the modules folder, rebuild and copy the new DLL into DNN's bin folder and you'll see the changes in DNN.
I would then go back to Host -> Extensions and click edit (the pencil) next to the newly created module. At the bottom of the page there is a 'Create Package' button. Follow the prompts until you're at the preview manifest file. Copy this as your modules manifest file and add it to your project.
Don't forget to add any new views, edits, settings controls to the module definitions and re-create the manifest. (Host -> Extensions and click edit (the pencil) next to the module -> Module Definitions heading)

visual studio extensibilty - How can I check if Silverlight debugging is enabled in an ASP.NET Web Site?

How can I programatically check whether a Web Site has Silverlight debugging enabled (ie, whether the "Silverlight" checkbox under "Property Pages->Start Options" is checked)?
I know that for a Web Application (WAP), I can check this via EnvDTE ( by checking project.Properties.Item("WebApplication.SilverlightDebugging").Value), but for a Web Site, I can't find an equivalent property.
For a Web Site project, there are properties named EnableASPXDebugging, EnableUnmanagedDebugging, and EnableSQLServerDebugging, but strangely there is no EnableSilverlightDebugging property. This might be a bug in Visual Studio.
Properties for Web Site projects are saved to the following file:
C:\Users\username\AppData\Local\Microsoft\WebsiteCache\Websites.xml
As a last resort, you can parse the file and read the value of the enablesilverlightdebugging attribute for your particular <Website>. Unfortunately, it seems that this file does not get updated until the project is closed, so the file may be out of sync with the actual setting.

Silverlight 4 OOB application and Images folder

I am developing a Silverlight 4 application which displays items in a carousel control. The items are parsed form an XML file and then loaded as an image which can be double clicked to open a website, file, image etc.
I am already running in higher privileges mode (out of browser) to access the Xml file which sits in a subfolder of the application.
I can load the images fine when they are added to the project as they are included as resources. However, I need to be able to load images which aren't individually added to the project. Instead, I would like to add all images in a particular folder as resources.
Is this possible?
Thanks in advance
From Advanced Silverlight Out of Browser- Introduction
When running in a trusted environment,
you can access only files in user
folders, specifically the MyDocuments,
MyMusic, MyPictures, and MyVideos
folders
So, if you want to access folders other than this, you would probably need to run some sort of service, which has the proper rights. What kind of service depends on where this app is running. Could be a WCF service, or a simple WebService, if you can run a webserver on the machine. Otherwise, you'd need a windows service of some sort.

WPF installation

I'm new to WPF, and created a 1st simplistic WPF application that I want it to run in a webbrowser, IE or Fox.
1 - Within the Visual Studio project, I created a /Images folder with a few .jpg files
On the WPF xaml form I have 1 image and 1 button.
When application starts, the image displays /Images/img1.jpg
When User clicks the button the image must display /Images/img2.jpg
How can I force the VS publisher to include the Images folder? Apparently I can't see it in the ApplicationFiles ?
2 - Though I was able to program and run this small app on my local computer, I'm getting lost when it comes to deploying to my hosting ASP where I have a Windows hosting account that runs .NET 3.5!
From Microsoft WPF website they say I shall deploy 3 files:
"The Application Executable .exe
The Deployment Manifest .xbap
The application Manifest .manifest
The .xbap file contains the information that ClickOnce uses to deploy the application and has the .xbap extension."
But I can's see no .xbap files at all within the published stuff!!!
Any clue please?
To answer your first question:
The images will be embedded in the compiled application, so you will not see the images in the application files.
Note:
The build action of images added to your project is 'Resource' by default - leave this as is.
Do not use the resources tab in the Project properties window, just drop and drag the images into the Images folder in the solution explorer.
To help answer your second question:
Did you create the project as an WPF Browser Application?
In your .csproj file you should see the following:
<HostInBrowser>true</HostInBrowser>
<Install>False</Install>
<ApplicationExtension>.xbap</ApplicationExtension>
<TargetZone>Internet</TargetZone>
If not, just recreate the project as a WPF Browser Application and copy your files from the existing project to the new one.

Resources