Can we delete project.json file? - msbuild

I just created a new project file. There is a project.lock.json file. Can we delete it?
Does it affect the build if my codes checked in without it?

Yes, you can delete it.
If you delete the 'project.lock.json' file, inside of Visual Studio. a new one will be created, based on the 'project.json' file.
I just deleted one because somehow it got corrupted. Instantly VS 2015 created a new one.
it wouldn't hurt to include this file if you have continuous integration/build server.
I hope it helps.

Related

TFS - reconstructing lost overwritten code?

I was working on a solution and under the assumption that I had already checked in my changes, I pulled down a new version of the solution and all the changes disappeared.
One of my colleagues suggested that as I often ran it in debug mode that there might be a dll kicking about that I can reverse engineer but dlls all seem to have overwritten too.
This is about 2 weeks worth of work so any help would be appreciated.
If you didn't shelve or check in the changes before the overwritten, I'am afraid you'll not be able to revert the file.
However when you edit the files in local, the changes will be temporarily saved to the TFS temporary diff files in "C:\Users\{user}\AppData\Local\Temp\TFSTemp". The files all have names like "vctmp38604_939733.cs". You can get the changes from them.
So, you can have a check for the folder, hopefully the diff files still there.
Just a suggestion: please ALWAYS shelve or check in code in time in case missing the changes.

Remove a duplicate Context.vb files from Entity Framework

I'm having a bit of an issue with EF6 in VS2013. I had to modify the connection string for the database-first model in a Web Application project so I followed the advice in the best answer for How should I edit an Entity Framework connection string? and deleted it from my Web.Config file.
At first it seemed to work fine, I deleted the connection string then from the Entity Designer I ran "Update Model from Database", re-created the connection string, but then my build failed with multiple errors similar to:
Public Sub New() has multiple definitions with identical signatures
After some digging I figured out that when I re-created the connection string EF created a second Model.Context.vb file named Model.Context1.vb and both are still referenced somewhere. Since then I've opened every file in the folder containing my EF model with notepad searching for a reference to Context.vb or Context1.vb and have come up empty, if I remove either file my build fails stating the file can not be found, so as a workaround I opened the Context.vb file and removed all the code so there are no duplicates, I'd like to fix it properly by removing the reference to the file deleting it if anyone knows how I can go about doing that.
I got it sorted out, after attempting to restore an older version of the EF files from source control and still running into the same issue, I realized the reference was probably in a project file.
In [projectName].vbproj I found these two entries:
<Compile Include="Data\schedulerModel.Context1.vb">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>schedulerModel.Context.tt</DependentUpon>
</Compile>
<Content Include="Data\schedulerModel.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<DependentUpon>schedulerModel.edmx</DependentUpon>
<LastGenOutput>schedulerModel.Context1.vb</LastGenOutput>
</Content>
I removed the first, and dropped the 1 from the context.vb file in the second, opened the project and ran a rebuild without issue.
I had the same problem but a slightly different resolution. For whatever reason, updating the edmx file one time seemed to remove a seemingly important line from the project file, the line reading <LastGenOutput>MyEntityModel.Context.cs</LastGenOutput>.
I re-added the line to my project file and updating the model didn't result in any more duplicate context files. The whole block looked like the following when fixed:
<Content Include="MyEntityModel.Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<DependentUpon>MyEntityModel.edmx</DependentUpon
<LastGenOutput>MyEntityModel.Context.cs</LastGenOutput>
</Content>
Just thought I'd add my findings to this as it has been driving me to distraction for a few weeks - every time I updated my Model from Database, I got "duplicate" context, designer files etc, and then hundreds of errors. However, the new sp or table or whatever I had added was only present in the new "context1" files, not the originals, so when I wound it back I had to go through the same process again etc etc.
Then finally a light went on when I thought of ... Source Control! I use TFS, and I found that unless ALL model-related files are checked out before doing the Update, so that's Context, Designer and Service files, then EF generates new versions of almost everything, presumably because it can't modify one of the files which are read-only due to source-control.
The key then is to fix the project file as stated in answers above before getting everything checked out and THEN doing the update. If you don't get that tag right in the proj file, it goes and does it all wrong again even though everything is checked out.
Hope this helps - my sanity is slowly returning anyway.
Ade

Visual Studio 2010 Setup does not create added file

My problem should be plain and simple to solve, but google is not helping me today.
I need to read/write a configuration file (config.xml) and, as i see so much problems with permissions with special folders, i decided for myDocuments.
Now, from File system (Setup), I added a custom special folder (myDocuments)
added a subfolder (g1OKweb) inside myDocuments
added the file (config.xml) inside g1OKweb
What I expect, reading around, is that during the installation g1OKweb should be created if not existing or older, and the same for config.xml, but it isn't.
Does someone have any clue?
Thanks in advance
Use Directory.CreateDirectory to create the directory before attempting to access the file. This will automatically create all parts of the path that do not yet exist. If the full path already exists, it will do nothing.
When opening the file, use a FileStream constructor overload that allows you to specify FileMode.OpenOrCreate. This will succeed regardless of whether the file already exists or not.
When you have opened the file, check to see if it is empty before parsing it. If it is empty, insert your XML root element first.

Visual SourceSafe 6.0 Replacing Same "Unchanged" Project Daily

Using Visual SourceSafe 6.0 and Visual Studio 2005. I recently copied a project from one directory. Made changes to it to serve a different purpose. Changed the name of the project and put it in a new directory. I then Added the project back into SouceControl with a new directory. However, every day when I log in and get latest version on the the two projects. All of the files are replaced every day. Even though, no changes have been made to one of the projects in months.
Is there anything that would cause this to happen day after day? Was there a config file somewhere that didn't transfer correctly?
Any help is much appreciated.
In order to remove source control from a sln you must do the above. From my experience, everything else maybe fail.
Remove all .vsscc , .vspscc and .scc files from ALL folders.
ReadOnly false all files.
Open sln with an editor and remove GlobalSection(SourceCodeControl) = preSolution Section.
Open each prj with an editor and remove all tags that starting with Scc.

VB.NET: Changes to application.dll.config file does not reflect inside system

I'm quite new to this app.config function. Hope someone can show me the road on this.
I have a solution which comprise of 5 projects and one of them just to retrieve the value from the app.config file to be read by other projects. So, in the app.config file, i have my connection string stated inside and i can use it nicely.
After i built the projects, it will convert my app.config file to appname.dll.config file and it can be seen in the bin/Release folder. I copy all these projects bin/release content to another folder to have all those files stay in one place.
My question is, which config file should i change if i want to change the connection string username (for example) WIHOUT building the project and transfer again? I changed the value inside appname.dll.config file but it does not reflect when the program run. It's still taking the old connection string.
Hope someone can help me on this.
Thanks in advance.
Usually the app.config associated with the exe project (command line or GUI) is the one that holds the changes app wide. Check for the appname.exe.config file and make your necessary changes there for connection strings, etc...
[update]
Just thought of something else... if it's a web project you can use the web.config in the main webproject to configure your changes