Application Title is missing when pinned to start menu - c#

I have a problem with pinning my c# application to the start menu in Windows 2008 R2. The application pins with the correct icon but the application name is missing. In effect I just get the icon displayed.
My csproj has an msbuild import that points to a custom target file to automatically generate the AssemblyInfo class. I have checked the generated AssemblyInfo file and verified that the attributes for AssemblyTitle, AssemblyProduct, and AssemblyCompany are set correctly.
Everything looks ok when I right click the .exe and look at the properties\details. All the information is displayed as expected, just not when the application is pinned.
Does anyone have any ideas as to why this might be?
Cheers,
Ben

Ok, so I have solved my problem.
I am a little hazy on the finer details but it seem that when an item is added to the startmenu a registry key is created containing metadata about the item.
Under:
HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\Shell\MuiCache
This regkey has a set of key/value pairs, one of which was the path to my .exe. The value was the display name of the executable. Modifying this value modifies the application name text displayed on the start menu.
Deleted this key and it was re-added correctly. It looks like when this key is initially set it takes whatever is set in the AssemblyInfo.AssemblyTitle attribute.
Problem solved.

Related

Renaming Windows Toolbar application link

I'm working on Visual Studio 2019 with C# and i'm stuck with this technical matter. I want to change the name of my app displayed on Windows bottom toolbar.
I tried many things.
I changed the solution name.
I changed (i suppose) ANY possible location of that word in the files.
I changed the name in the application tab in the solution properties.
I changed the folder name and project name (opening the project file via notepad).
I removed obj and bin folders and cleansed/rebuilded.
I removed old files named with their old version (when i renamed things in visual studio, instead of renaming some files it created new files with the new name, so the old files with old name remained).
I already did this weeks and weeks ago, it worked...but never did it before and i was a bit confused and randomly trying. I thought the real thing was just opening the project via notepad and changing its content (so i even wrote myself a note to remember it), but it's not. I don't understand what i'm missing.
I did something useful by trying to play it as Release and not Debug, but i also managed weeks ago to change it as a Debug as well and just don't remember or understand how to do it.
Thank you in advance!
(Edit: i'm trying to edit it again to change a letter into Upper Case, but also running it into Release it doesn't change and stays Lower Case...definitely something goes wrong with all this)

C# Couldn't process file xxx.resx due to its being in the Internet or Restricted zone or having the mark of the web on the file

I have an issue while I try to build project in VS2012.
It cannot build due to the error:
Couldn't process file xxx.resx due to its being in the Internet or Restricted
zone or having the mark of the web on the file. Remove the mark of the web if
you want to process these files.
Here is a similar question.
but I tried that option and had no luck, because I did not download the file from the internet. That project was built from scratch. In project after selecting Properties, in Windows Explorer nothing happened. I do not have the "unblock" option, only the default three options (read only, hidden, and archived).
I have the same error and cannot build or rebuild the project. I have a theory that it is a recent error after updating Windows. Before the update, everything worked fine. Any ideas?
Go to xxx.resx file in Windows File Explorer. Right-click and select properties. At the bottom of the the dialog is an "unblock" option:
Check this and click Apply. Clean your solution and it will build.
In my case I had the same problem with many files.
My solution with VS Prof. 2017 V15.95 was:
Open powershell and execute dir -Path [directory path] -Recurse | Unblock-File
Rebuild all
On the solution folders locate abc.resx.
Open the file using any text editor, preferably Notepad++.
Locate and delete any node starting with <data
Example. This is what you should delete.
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
AAABAAMAICAAAAEAIACoEAAANgAAAGBgAAABACAAqJQAAN4QAACAgAAAAQAgACgIAQCGpQAAKAAAACAA
AABAAAAAAQAgAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
///////////8AAB/////////
</value>
</data>
Reload or reopen your solution and build. You are ready to go.
Had the same problem after updating to VS 2017 v15.8.5, and none of the solutions above or on other forums worked for me.
So, since a .resx file is just XML, I just copied the content, deleted the original file and recreated it with the copied content.
That was the only thing that worked, and it worked first time.
A quick way to remove this mark of the web for multiple files and folders recursively for me was to
Zip them up.
Delete originals.
Unzip.
I'm not really sure either, I have the exact same issue.
But, what i did, was hit view in file explorer.
Then, i clicked show hidden items.
Finally, i went back to my folder and clicked on the .vs folder, my project/file name, v15, Server, sqlite3, and deleted DB.Lock.
I reopened the project, clicked build, and it worked perfectly.
This worked for me, it might/might not for you.
I also encountered this issue recently. The error began occurring after I set the icon of a Windows Form.
Researching for the cause and solution almost led me nowhere, because I did not download the icon from the internet, nor was I referencing a web-based icon file. It was stored entirely on my local machine.
After some more researching and digging around, I was able to figure out exactly what was causing the problem. I have Microsoft One-Drive installed on my machine. The directory in which the icon file was located is managed/synced by One-Drive. That fact was somehow tricking Visual Studio into believing the file was located or downloaded from the internet.
The solution proved to be very simple. I removed the icon from the form, as well as from the corresponding .resx file. Then I moved the icon file to another directory not associated with One-Drive. Finally, I was able to use that icon in my Windows Forms application without getting this error.
I understand there are other possible causes for this error. But if in your case, the issue happened after setting a form's icon--and if you have One-Drive (or perhaps another cloud-based storage solution) installed--then check to be sure that icon file is not in a directory managed by that service. If so, relocate it and change the form's icon property to point to the new location.
To fix this for multiple files within a project, Visual Studio -> Tools -> Options -> Trust Settings and add the project path as a trusted path.
Using VS 2019, and building against source stored on an Azure shared file system. I think I may have just tracked down a work-around, and it has to do with the Icon as referenced above by Jake above. If I add the icon to the form's resource file (that really long string), The error occurs.
However, if I add the Icon to the Project's resources, delete the Icon from the form's resource file, and change form to set the Icon manually...
this.Icon = MyProjectName.Properties.Resources.MyIcon;
The error goes away.
I found this solution on another forum. My project resided on a file share, so I had to enter file://[file share] for Step 4 below. I am running VS2019 on Windows 10.
Start Menu > type 'Internet Options'.
Select Local intranet zone on the Security tab then click the Sites button
Click Advanced button
Enter file://[computer name] or file://[file share]
Make sure 'Require server verification...' is unticked
I had the same issue in Windows 10 VS 2019 16.4.457 (previous version of VS 2019 had no problems).
The "marked for web" error shows only after I moved the project under One-Drive.
If I move the project back to a local drive the error doesn't show.
As Anthony Gingrich suggested, I tried to move the project images to a local directory without success.
The solution that works for me was, for each image, in the "Select Resource dialog" use "Project resource file" instead "Local resouce".
Please guys, I already fixed the issue, this is cause by OneDrive, please close your OneDrive with the use of task manager or close the icon OneDrive's Hidden Icons on the taskbar
I just ran into the same issue and also tried the Unblock option from explorer with no luck. I even restarted VS with no luck.
However, I'm not sure which combination did the trick but I opened the form as well as the resx file from within VS, just to see if I can open it, which opened fine. I then did a clean and rebuild and that appeared to do the trick. If it doesn't try restarting VS after the clean then rebuild.
I had a similar issue and the problem was an image that I had downloaded and added to my Resources. Not completely sure why that was the only image that gave me problems, however, I opened my abc.resx file giving me issues an a text editor, removed the node starting with " (it was the last and only node) just like Albert Alberto mentioned. Saved the changed, cleaned and rebuilt my solution and it all works! The image didn't render but it only took a second to go back and add the image. It wasn't removing the entire file, just the node that was causing the issue.
I had the same problem on Windows 10, VS 2017 (15.9.13). I sent myself a project from work through Dropbox so I could try a couple of things from home. But when I tried to build it VS gave me the 'marked for web' error.
After trying the solutions above without success I began experimenting. I was able to solve this by using the method listed above (right click -> properties -> unblock), but I had to do it for each of the images in the Resource folder--and I had to do EACH FILE individually since the 'unblock' option was not available on group-selects. I actually unblocked each source file in the project as well before trying to rebuild so I am not sure if both are required.
Its a bit of a pain--probably a huge pain for larger projects--but it absolutely got the project building again.
EDIT: I did find this article afterwards about unblocking entire folders--even recursively but have not tried it: https://www.winhelponline.com/blog/bulk-unblock-files-downloaded-internet/
None of these worked for me. I fixed it by converting the embedded base64 into a linked resource:
I found out the issue was with the embedded base64 image I had in the .resx (as the issue went away removing the data tag as explained in this question but that meant I removed the image) so I converted the embedded image into a .png file and made a link to that in the .resx.
To do that: open the .resx file in Visual Studio 2019 and double-click the image, and then click Ok and Yes in the following prompts that will appear so VS will convert the embedded image into a linked resource (sorry I can't upload pictures yet):
Hope it helps!
From my original comment.

C# Install - Change a custom folder location using install dialog

I am trying to install a windows service using a visual studio setup project. All is going well except I want the user to be able to use the install dialog to specify the location of a custom folder to be created during installation.
I've added a Textboxes dialog that stores a folder location in an Install Property (PATHPROPERTY in this example) but I can't figure out how to use that to change the path of a folder I'm creating during the installation. I set the 'Default Location' Property of the custom folder in the 'File System' menu to:
"[PATHPROPERTY]\folder"
But when I change the path in the install dialog, the folder is created at the default location of PATHPROPERTY, not what I change it to during install. So it seems like the folder is created before I reach the point in my dialog where I ask for the path.
I noticed that there is a Property Property for the folder that I can set and supposedly use to modify the location of the folder during installation, and I've seen some articles suggesting that this can be used to set the location using a command line flag. But I would like to be able to use the install dialog, then possibly set this property in my installer class, but I haven't found any documentation on how to do that yet..
I also found something about Session.Property to set the property but the documentation wasn't clear on how to use this.
Any help would be much appreciated.
Oh. Also. I'm targeting .NET 3.5.
So PATHPROPERTY returns the custom folder location user has selected, If thats the case you have to set that property to "Property" attribute.
Also make sure in the User Interface Editor you are getting the user input before installation starts. (You can move up and down the UI to required position)

C# visual studio - Properties.Settings.Default.SomeValueOrAnother has me baffled

C# visual studio project: Properties.Settings.Default.SomeValueOrAnother has me baffled.
I have a relatively simple project. It saves a bunch of last-entered values between sessions, and restores them on next invocation. Was working fine. I changed a control so that the minimum allowed value was no longer 1, but was now 100. Last used value had been 3. On startup, it now complains that 3 is not a valid value.
Well, duh, of course – but hear the rest.
I have edited Settings in VS to default to 500. I have edited the exename.config file to contain 500 instead of 3. I have examined every possible config file (vshost.exe.config, the files in bin/debug, bin/release, obj/debug, obj/release. They all contain value=500. I have re-built repeatedly. I have copied just the exe and the config file to a separate PC, so that the development environment was not a factor. I still get this error message.
To further confuse me, on the dev PC, if I run (directly, not in the debugger) the exe in /obj/debug or /obj/release I do NOT get the error. If I run the ones under /bin I DO get the error. The config files have identical contents. If I copy the exe & config from /obj (the one that does not give an error on the dev PC) to another PC, I DO get the error.
I thought exename.config was all I had to deal with, but it looks like VS is doing something behind my back – at least something that I cannot find in the documentation. I imagine this is something trivial. If anyone can explain what I've missed I'd sure appreciate it. All I really want to do is reliably save some user settings from one run of the program to the next. And get this app to 'forget' that obsolete value.
TIA
Mickey
Look for *.settings files in your solution. That's where the value that's used when you build your project will be stored .
This was not the entire answer, but it did explain where the mystery values were being stored:
"This might help to some people dealing with Settings.settings and App.config: Watch out for GenerateDefaultValueInCode attribute in the Properties pane while editing any of the values in the Settings.settings grid in Visual Studio (VS2008 in my case). If you set GenerateDefaultValueInCode to True (True is the default here!), the default value is compiled into the exe (or dll), you can find it embeded in the file when you open it in a plain text editor. I was working on a console application and if I had defaults in the exe, the application always ignored the config file place in the same directory! Quite a nightmare and no information about this on the whole internet."
...in another post here. I am now individually testing values read from settings, rather than trusting it, and forcing them into valid range if required.
Truly an ugly, and well hidden, default. I haven't embedded data values in my executables since the days of CPM. Jeesh.
Thanks again, Microsoft.

How do I change the default Virtual Directory name during a web service install?

I have a C# web service, created using VS2008.
I have a deployment project that creates the MSI I use for deployment.
Is there a setting somewhere to change the default virtual directory that the user is prompted with during the installation?
I'd prefer to not change the name of the webservice to do this.
But isn´t this a simple case of right-clicking the setup project:
select View-> File System.
From the File system explorer, click the Web Application Folder. Press F4 to bring up the properties window (if it isn´t already visible).
In the properties window, scroll down to VirtualDirectory and change it to whatever you want.
Does that work for you?
I think I have the fix.
I couldn't find a fix thru the VS UI, so you'll need to locate your deployment project (file extention is .vdproj) and open in notepad.
Search for "VirtualDirectory"
You'll find a line similar to this:
"VirtualDirectory" = "8:OldName"
Where OldName is the current default you're seeing during installation.
Change "OldName" to whatever you want for a default. Save and build.
If there's a way to do this thru the UI, that would be even better, I couldn't find it and this works.
Visual Studio 2015. The virtual directory can be changed on the properties for the Web.ApplicationFolder for web applications

Categories