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.
Related
In my application, some setting are coming from JSON settings file. The setting file can be updated from within the program and a .cs file is created from these updates with using T4 Text Template. So when the JSON file is updated, I want that the T4 Text Template also works and update the .cs file. If this is not possible, I would like the T4 Text Template to run and also update the .cs file when I restart the program. But I have no idea how to do it. I managed to create .tt file and it works perfectly when I save .tt file in the Visual Studio.
Note: I have googled for 2 days and read all topic in the site. But I did not reach any result.
You can run command-line transform tool. Here’s an example:
"C:\Program Files (x86)\Common Files\microsoft shared\TextTemplating\14.0\TextTransform.exe" "C:\src\template.tt"
That will use TextTransform.exe from VS2015. VS2017 also has TextTransform.exe, even the freeware community edition, it's located in C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\
Documentation for the CLI is available.
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 am a beginner to C#. I just created a simple form for my project using Visual Studio 2010, by importing some pictures into it. After deleting some unwanted images from Resources file it is giving the error:
"Error 7 Invalid Resx file. Could not find file
'C:\Users\HP1\Documents\Visual Studio
2010\Projects\test\test\Resources\331295-krishna-playing-flute.jpg'.
After that I can't able make any changes in my form. Even after If I am making any changes it is not reflecting while executing the program.
in your project open your resx file in visual studio.it is xml file and easily readable. you need to remove those line which are causing this error (If these images are of no use) or place the given jpg file at the required location
I can't look at your file, but maybe error is that file contains source on files that do not exist. Remove those sources.
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
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.