I am failing to find fast way to add images in Visual Studio 2017 WPF Application.
In previaus versions you could Browse for new images and add to Resources folder.
Are these features removed?
Before:
Now:
Double click the project Properties item in Solution Explorer
Go to the Resources tab
Click on the small downward triangle next to "Add Resource" and select "Add Existing File". This will open a file selection dialog. Navigate to your images folder and select the images you want to include.
This will create a Resource folder in your project.
In solution explorer, select each image in turn and change the Build Action in Properties to Content or Resource.
You should simply be able to drag and drop it in, try rebuilding the project and ensuring the image is set as a resource file. If its still not working try closing down and reopening visual studio.
Related
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
I have a winform app running on .net 4. When a certain condition happens, the icon running in the task bar changes from ping_logo to ping_logo_red. (the icon i'm talking about is the one that shows up when you run an application. You click on it and it will restore the windows to the screen or minimize it) The way that the icon is changing is as follows.
I added the ico files as Resources. In the code I change the resource being used
Me.Icon = My.Resources.ping_logo_red
Here is the thing. This works when I run the exe from my machine from the solution bin/release folder. When I publish this and install it from the published location, the icon does not change.
In the publish tab under the project both ping_logo.ico and ping_logo_red.ico are included in the publish status.
what have I not done that is keeping the icon from working in the published app. I've tried to uninstall the app and install it fresh but that doesn't seem to make a difference.
thanks
shannon
If you are using ClickOnce to publish your application then you need to set the icon property in the properties window of your project.
Right click your project -> Properties
Go to application tab
Select your icon file towards the bottom.
Another idea is changing the CopyToOutput property of your .ico file to "Copy Always" or "Copy If Newer".
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)
We have a silverlight application written in Visual Studio (VS) 2010 and we want to deploy it on a Windows Server 2008 R2 box (IIS7). To deploy it in VS I did a right click on the MyProject.Web project, selected "Publish...", from the "Publish method" I selected "File System". I copied the folder over to "C:\inetpub\wwwroot" on the server. In IIS Manager I did a right click on the folder, selected "Convert to Application", a window popped up, where you can select the application pool. I selected the default (.NET 4), I clicked on "Test Settings..." it failed (that was a bad sign), clicked ok.
When I try to access the website from a browser a message box pops up saying do you want to open or save "MySilverlightApp"?
Basically, it wants to download the xap file like it would download a text file or a doc file, it doesn't "run" it.
I have checked the forums and most cases the issue is that the MIME file types are not set up, but I have checked that it's all looks good, and it should as well because on IIS7 it's all set up by default so I am puzzled a bit here.
Thanks for your help.
I have just realized that you tried something about mime types so I need to edit my answer. I want to share a link to provide you a guide. It may be helpful to see if you miss a point.
http://www.iis.net/learn/web-hosting/web-server-for-shared-hosting/configuring-iis-for-silverlight-applications
The route cause of the issue was that the XAP file (inside the ClientBin folder) was the default document.
When I set the aspx file (in the application root folder) as the default document, it started to work fine.
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.