I have a text file as an embedded resource & can read it fine during runtime. Now when I want to update this resource, it works fine if I edit the file in Visual Studio and then rebuild BUT if I edit in an external editor eg. notepad then the changes are not seen in Visual Studio.
I have tried cleaning then rebuilding but nothing seems to force an update of the resource file - any ideas?
Argh! I see the problem now. VS copied my original file into the solution folder (the one below the .sln file) and VS is using that file. I was editing the file in the original location from where I created the resource.
Related
I've just had a visual studio crash (2012 - Using Monogame) and now my main.cs file in my project shows up as a blank text file when opened in Visual studio.
The file itself still shows as 134kb so it isn't blank? No matter what I do the project cannot find the file .. every other .cs file is fine.
There is no backup that I can find .. I'm hoping there is some way of reading the file and recovering the code.
Monogame does not have a main.cs file.
I will assume is is user created. The Main() function is in Program.cs.
I would suggest moving to VS 2022 Community Edition, it is free, and Monogame 3.8.1.
Create a new project and copy all of your class files into it, modifying the namespace of each to match the new name.
Copy your content sources and add them with the mgcb-editor.
Following on from my issues with a simple Visual Studio Installer Package, I'm making the switch to WiX. The learning curve is annoying, because once I've set this up I'm going to forget how it works before I need to do it again next project. But anyway, here we go.
My environment is Visual Studio 2019 and Azure DevOps (the full TFVC). The projects involved are class libraries and a WPF application all written in C#. I also have the WiXWax extension thingy to give me a GUI for adding projects and dependencies quickly.
When I created my WiX project I stupidly included a typo in the name of the project and consequently in the underlying folders. When I noticed this I decided to fix it;
Unload the projects
Using the source control explorer, rename the folder
Using notepad, open the sln file and correcting the path to the project, and the project name
Using notepad, open the project file and correct its references to the path and project name
Rename the project files
As you can see I have changed every reference to the the incorrect spelling.
Unfortunately, Visual Studio won't load the project. I get an error telling me this:
C:(correctly spelled path that matches the file system and file names).wixproj
: error : The project file
'C:(path with a typo in it)(correctly spelled project name).wixproj'
has been moved, renamed or is not on your computer.
Now the message is partly correct, because the file it says has been moved or renamed has in fact been renamed. If I click on the error it opens the wixproj file (it's just an xml of course). This file doesn't have a self referenced location though, the only things that's close is the include to the projects which haven't changed and are correct (..<correct detals>.csproj)
I have opened every xml file including the solution files and wix project files and none of them contain the typo (Ctrl+F, case insensitive, not whole word - no results).
I have tried "Removing" the WiX project from the solution and re-adding it, but I get the same error and it doesn't add it to the solution file.
What is remembering the old path name, and how can I make it forget it?
edit: I've also tried Ctrl+Shift+F per Klaus' suggestion and it finds no references.
I read this post about .resx files having a corresponding .designer.cs file that is generated when you create a new .resx file in Xamarin studio. I am using .resx for localization in my Xamarin shared project.
Unfortunately as of 24 Aug 2017 and version 15.3.2 , it seems that you are no longer able to create a .resx file through the Add->new item solution wizard.
One solution is to create a .resx file outside of VS, and then use the Add->Existing Item solution wizard, and the .designer.cs file is supposedly generated automatically. (this did not work for me)
Another solution is to change the file format of a .txt file in the solution wizard, and then run the custom tool ResXFileCodeGenerator in the AppResources property field. (This also did not work for me)
One final solution I found is to programmatically create the designer file, but I couldn't get this code to run, and surely there is a better solution.
So my question is:
What is the correct way to create a AppResources.resx file, with a corresponding AppResources.designer.cs file in Visual Studio Community 2017 Version 15.7.3
I have a weird problem with my C# solution file. I noticed that my .sln file itself was missing. So I created an empty .sln file, added my Existing projects to it, built and it worked fine. When I close and reopen Visual Studio, the .sln file I created is there but projects added to the solution have disappeared. How to fix this?
It sounds like you are having issues with write permissions in your solution. Is the folder your solution is in under any type of source control?
Try creating a new folder at the root of your harddrive. Something like c:\testsolution
Copy your project files there and then try adding you solution file again.
Good luck.
Most likely this is an issue with not saving the changes to VS solution file.
Before closing Visual Studio, take an extra step to make sure all changes are actually saved (File-> Save All). Then manually verify that all your projects successfully made it to the solution file by opening the solution file with a text editor. If you don't see your projects listed, try editing the file yourself to verify you have the necessary permissions.
I want to make a backup from the whole project. I also need to rename every backup. I'dont like the way to copy the project folder and rename the folder and the project file.
I've already tried to make it like that:
http://jasonfaulkner.com/VisualStudioExpressProjectBuildBackups.aspx
But it doesn't work, I am always getting the error "Invalid parameters"
Does anyone already tried this?
Thanks
The DPack extension for Visual Studio includes the Solution Backup tool that creates a zip archive of the solution and auto names it.
Manually edit .sln file
This method is entirely aimed at renaming the directory for the project, as viewed in Windows Explorer.
This method does not suffer from the problems in the Remove/add project file method below (references disappearing), but it can result in problems if your project is under source control (see notes below). This is why step 2 (backup) is so important.
1- Close Visual Studio.
2- Create a backup of your .sln file (you can always roll back).
3- Imagine you want to rename directory "Project1" to "Project2".
If not using source control, rename the folder from "Project1" to "Project2" using Windows Explorer.
4- If using source control, rename the folder from "Project1" to "Project2" using the functions supplied by source control. This preserves the history of the file. For example, with TortoiseSVN, right click on the file, select TortoiseSVN .. Rename.
5- In the .sln file, edit all instances of "Project1" to be "Project2", using a text editor like NotePad.
6- Restart Visual Studio, and everything will work as before, but with the project in a different directory.
Alse would recommend TFS, a powerfull tool to do what you pretend. You will be able even to recover previous versions of specific files,if you have any error and you have troubles find it you can see what changes you did since last "check in " etc. There are many options