C# can't find properties file, how do I repair this? - c#

I had a Properties file called RecentFileList within my Visual Studio 2012 project and I removed it. I believe it was a .settings file. Now when I run my setup project, it is trying to copy files that it shouldn't care about and it's bombing out as a result. I get 3 errors (-1007 -6271 and -6103), all related to the same missing file.
-6103: Could not find file "C:\Users\Charles\Documents\Visual Studio 2012\Projects\RallyCourses\RallyCourseDesigner\bin\Debug\Properties\RecentFileList.Designer.cs
What file do I need to edit to get rid of the reference to this file? I tried searching for RecentFileList.Designer.cs, but can't find it.

The offending files in my situation were trying to be installed by the installer, but I had removed them from the main project. Within the SetUp project, there is a section Specify Application Data -> Files. I found the files in the Properties section there, removed them, and things are working now...

Related

Publishing a program and missing files

I am testing publishing a program with Visual studio 2012, but when I install said program I get errors because a database file I need is missing.
I have a small sqlite file I have included as content and I have set it to copy to output directory. and everything works if I am debugging it. but when i publish the file isn't there anymore.
I guess the problem has two answers I can see, I either need to figure out how to have the file be put there when it is installed or on startup of the program look for the file and if it doesn't exist, copy it to there from a resource?
any clues would be appreciated!
thanks!
The following link should show how to include files for publishing: http://msdn.microsoft.com/en-us/library/kzy0fky2(v=vs.80).aspx
Specifically:
Files with the Build Action property set to Content are designated as application files and will be marked as included by default; they can be included, excluded, or marked as data files. The exceptions are:
•Data files such as SQL Database (.mdf and .mdb) files and XML files will be marked as data files by default.
If you change the handling from Data File (Auto) to Include, Visual Studio should output it correctly.

How to include other files to the output directory in C# upon build?

I have some library files needed for my application to work.
My application has a setup and deployment included.
I already know that in order for a library file to be added to the output directory of the application when installing, I just have to reference those libraries inside the .NET IDE before building... the only problem is that these libraries can't be referenced... So I need to be able to copy these libraries to the installation directory of my application... At the moment, I am copying these libraries manually...
Addendum
I also did try to add these library files as an Existing Item to my project and marked each library files' Copy to Output Directory to Copy if newer on their properties but still not getting the solution I want.
Update 1
Thanks for you help guys it helped me solve my problem, I managed to make the solutions you posted work except for one... #Matthew Watson's post.. I even managed to find a solution too so I wanted to share it with you also.
Heres what I did:
I opened the setup and deployment project in my application.
Under the Application Folder Tree, on it's right side, I right clicked..
then clicked Add..
then clicked File
and then browsed for the files I wanted to add to the installation directory
and click open.
But out of curiosity...I am still trying to make what #Matthew Watson posted work...
Update 2
I forgot to update this post yesterday, I already manage to make Matthew Watson's solution worked yesterday. Thank you again for all your help guys.
You can add files to your project and select their properties: "Build Action" as "Content" and "Copy to output directory" as "Copy Always" or Copy if Newer (the latter is preferable because otherwise the project rebuilds fully every time you build it).
Then those files will be copied to your output folder.
This is better than using a post build step because Visual Studio will know that the files are part of the project. (That affects things like ClickOnce applications which need to know what files to add to the clickonce data.)
You will also be more easily able to see which files are in the project because they will be listed with the source code files rather than hidden in a post-build step. And also Source Control can be used with them more easily.
Once you have added "Content" files to your project, you will be able to add them to a Visual Studio 2010 Setup and Deployment project as follows:
Go into your Setup project and add to your "Application Folder" output the Project Output called "Content Files". If you right-click the Content Files after adding them you can select "outputs" and see what it's going to copy.
Note that Setup and Deployment projects are NOT supported in Visual Studio 2012.
You can use Visual Studio Post Build Event - Copy to Relative Directory Location. Which are basically scripts that are executed on build of specified project.
So you can use it to copy binaries you need, before actually running your application.

Could not find file 'obj\Debug\OldProjectName.csproj.FileListAbsolute.txt

I'm trying to publish project (tools vs2010), but cannot all the time getting the error below.
I paste to my projects files from another project and then I changed namespace (OldProjectName) to the parent project (NewProjectName). But it still getting information from somewhere about old project.
I cleaned solution, builded, rebuilded. Closed and reopened again and all the time the same error.
I'm able to build project but publish it.
Any ideas what can cause the problem?
Error 1 Copying file
obj\Debug\OldProjectName.csproj.FileListAbsolute.txt to
obj\Debug\Package\PackageTmp\obj\Debug\OldProjectName.csproj.FileListAbsolute.txt
failed. Could not find file
'obj\Debug\OldProjectName.csproj.FileListAbsolute.txt'. 0 0 NewProjectName
Open your .csproj file in notepad
Find "obj\Debug\OldProjectName.csproj.FileListAbsolute.txt"
Remove that line and save it
Open your project and try to publish it and this time you will be succeeded.
Note: if you are getting any more file like .pdb remove that as well.
Hope it will help you
Make sure the obj folder is not read only, if so change read only property of this folder to false. this worked for me.
Check the permissions to the folder obj\Debug\ if you give it write permissions, the error would go away.
Check if the folders "bin" and "obj" are checked-in to source control, if so delete those two folders in source control. There is no need to check-in these two folders to source folders. Also make sure that these folders "obj" and "bin" are deleted from your hard disk, they will be created again after a build.
Hope this will fix your issue.
It is your responsibility to make copies so you can go back to one.
Open your project file (vb/cs)proj with a notepad, and search for the missing files.
In my case I got this error when I tried to publish the project and certain files were not found.
Each publish attempt I got another file name, after checking that the file actually didn't exist in the project, I removed it from the project file, manually.
Then publish succeeded.
Delete the obj folder and build again.
Ref: http://forums.asp.net/t/1402005.aspx
Like many others these files were read only and needed to be deleted or actually able to be overwritten by VS. However, as may be the case for many others, the problem was because these files were checked in to source control. Your bin and obj folders should not be in source control. Mark them for delete and submit the changelist.
One exception to the rule is for the bin folder could be dll files that are not .Net compatible. Such as a C/C++ dll that you are using through a .Net wrapper dll. I mark them as content so that they get published and check them into source control.
I too had this problem. I resolved this by deleting files inside project bin folder (.dll and .pdb) and closed and re-opened VS .
The file named FileListAbsolute.txt was deleted from the folder obj/debug. Visual Studio can automatically recreate the file and others in the obj/debug for you.
For VS to recreate it, set the configuration of the solution and the project to debug mode. Then rebuild your solution.
To change the configuration mode to debug, from the solution explorer, right-click on the solution name and select Properties.
Select Configuration under Configuration Properties. Then select Debug from the dropdown list.
Click Apply and OK. Ensure that in Configuration Manager, the configuration mode is also a debug mode.
Then rebuild your solution.
For me using solution here: Certain Razor views not publishing
Excluding the views folder and re-including fixed it for me. So it's possible for anyone else experiencing this it may be as simple as excluding and then including the file/folder in question of your project.
I encountered this bug using VS2017 with a solution stored in OneDrive.I suspected OneDrive's sync mechanism to be the root cause of this.
When I tried to reproduce using VS2019 however it did not reappear. Looks solved in between these versions.

For a Silverlight 4 Visual Studio solution, what needs to be in version control?

I have a Silverlight 4 app that I'm building with Visual Studio 2010. I'm using Mercurial/TortoiseHG to do version control. Which files do I need to check in? By default, it checks in all sorts of .dlls in /bin/debug and stuff. Do I really need those? Or can I just grab code and content files? Do I need to version something to keep track of project properties and references, or is that contained within the .csproj file itself?
You don't need to include stuff in /bin or /obj. This is true of all VS solutions in source control. These are recreated upon every rebuild. Also, for Silverlight specifically, you don't need to check in the XAP file that is generated in the ClientBin of your web app.
From MSDN (via this social.msdn thread):
You can add the following files to Visual Studio source control:
Solution files (*.sln).
Project files, for example, *.csproj, *.vbproj files.
Application configuration files, based on XML, used to control run-time behavior of a Visual Studio project.
Files that you cannot add to source control include the following:
Solution user option files (*.suo).
Project user option files, for example, *.csproj.user, *.vbproj.user files.
Web information files, for example, *.csproj.webinfo, *.vbproj.webinfo, that control the virtual root location of a Web project.
Build output files, for example, *.dll and *.exe files.
It doesn't say anything specific about Silverlight projects though.
Is Mercurial/TortoiseHG integrated into Visual Studio? i.e. can you check out/submit from within VS?
If so, if you right click on the project name and select "Add Solution to Source Control" it should add those parts of the project that it needs ignoring everything else.

Programmatically Reloading a C# Project

Is it possible to programmatically reload a C# project? In one of my previous questions I needed to add all the CS files in a specific folder, now while this works I find that I have to reload the project every time to so that it can register the new files were added.
So now I need a way to automatically reload after the project had been generated.
I assume, for the first time when you output all the DAL files, you are also creating a file with extension .csproj listing in it, all the files you just added in the folder.
If my assumption above is right:
When you want to add more files, you can programatically edit the same .csproj file from your c# code. Then, Visual studio will force the project reload saying it has changed outside the environment.
If my assumption above is wrong:
You can create the .csproj file, It should be easy and straight forward.
I am not sure If I got your question right.

Categories