Visual Studio Solution - vb.net

My program adds files to a VB.NET solution. What I want is that the project, when files are added to it, is refreshes or prompted to refresh. Now what I am currently doing is unloading and reloading the project. This is fine, but I noticed that my newly added files are not included in the project, and I have to manually include them by clicking them.
How can I make my project add all files that are not included and refresh when new ones are added?
Thanks
My code to add.

A lot of files can exist in folders and subfolders under the solution (sln file). not all of these files are required to participate in projects. each project file (vbproj / csproj) maintains the inventory of files included in the project. you need to both place your files at appropriate places and update the vbproj file appropriately.
As it happens, the vbproj files are not simple indexes, they are full blown build scripts. they have a pretty intricate file format (XML) and a convoluted semantics. Appending nodes in that file works fine if you follow the existing pattern. but i suggest you look up MSBUILD first.
Please note that if the project you are mutating programmatically, is open in visual studio, then there are strong chances of inconsistency. make sure the project is not open in any visual studio. programmatically altering the program itself (or the same project) is not advisable.

Related

Modify website MSBuild options to include configuration in path

I'm in the process of updating an old solution from Visual Studio 2005 to Visual Studio 2015, and I'm trying to reproduce as much of our old kludgy behavior as we safely can to minimize the downstream effects. I'm currently running into an issue with the Website Property Pages and MSBuild.
The path here is mostly correct, except that we want the configuration used to be in the path as well. So a Debug build will go into E:\Projects\...\PrecompiledWeb\Debug\MyService and a Release build will go into E:\Projects\...\PrecompiledWeb\Release\MyService. Is this doable? Is there a variable I can insert to make that determination when building?
We're using msbuild against the containing solution file (via TeamCity if it matters, but I can replicate it without it).
Edit: I've found the Debug.AspNetCompiler.TargetPath and Release.AspNetCompiler.TargetPath paths in the solution, but if I change them to be separate, the Debug one overrides the Release one when I next open the dialog.
When MSBuild starts building the project, it takes one or several project files. This dialog takes it parameters from MSBuild project file (you can edit it either from Visual Studio, or simply in every text editor). The project should have the property, called $(Configuration). You can use it in your output variable:
<OutputPath>E:\Projects\...\PrecompiledWeb\$(Configuration)\MyService</OutputPath>
One thing you must aware of is that the property $(Configuration) must be declared before the $(OutputPath) property.

TFS Build dropping extra files including csproj in target folder

I have an automated build process set up to run from a build definition in TFS, which publishes a web application and generates/executes a database project script successfully via publish profiles that are passed as msbuild arguments in the build process definition. Everything is now running as expected except that several unnecessary files are being deployed to the target folder, including the .csproj file, all of the config transforms, and the properties folder which contains all of my publish profiles.
This is strange because 1. It's definitely not including ALL files/folders and mostly appears to be including ones used by the publish profile like transforms, while applying the transform correctly and excluding any explicitly excluded file (as defined in the pubxml), and 2. The process works perfectly if I do it by publishing from the project in Visual Studio 2013. I have the profile configured to only include files needed by the application, and I've confirmed in the csproj file that this property is there.
I tried excluding the properties folder from deployment in the pubxml file, but this causes the build to crash because it can't find the assembly file. What I've gathered is that the process is keeping all files it needs to complete the build, and dropping all of those files in my destination folder. FWIW, I'm using the "file system" method and I'm not sure yet if web deploy will make a difference. I haven't been able yet to connect to the target server with web deploy, but that's a separate problem to solve. Is there something in the build that I can configure so that my destination folder has only the files it needs to run the application, and not the files needed to BUILD the application?
FYI I also have not been using a drop folder, I'm not sure if that makes a difference or not but that might be the only thing I haven't tested as it doesn't seem necessary since I'm using a publishprofile and don't want to use the default tfs build configuration.
I found a solution that works well enough, after reading this: http://www.asp.net/web-forms/tutorials/deployment/advanced-enterprise-web-deployment/excluding-files-and-folders-from-deployment
This was a little uglier solution than I wanted, since it requires hard-coding the names of excluded files, but it does the trick and only requires identifying the files and folders in one location instead of altering a publish profile for each target environment. I created a wpp.targets file and used the ExcludeFromPackageFolders and ExcludeFromPackageFiles elements to identify the extra files. Ironically, if I don't also name the wpp.targets file in the exclude element, THAT file is included in my package. It's possible MSDeploy doesn't have the same issues with TFS as filesystem, but after spending half a day trying to work through a different set of issues and permissions workarounds, we decided that file system is a cleaner publishing method.

Visual Studios 2010 Shared Project?

I have been searching around for an answer to this question, but I cannot find the documentation on it. I found a few similar questions asked here, but none that completely cover it?
Similar Question
What do all of the different files in the project directory do? I am trying to make my project open source and I don't want to have a ton of unnecessary files in my repository. What files are vital and what files will be generated when the user initially loads the project? Its important to note that this is a VB Form Application
Base Directory:
*.vb
*.Designer.vb
*.resx
*.vbproj
*.sln
*.vbproj.user
*.config
Any of the other folders in the base directory?
*/bin
*/Collection
*/My Project
*/obj
*/Resources
*.suo and *.user files can be ignored. They store user specific settings such as window arrangements, open files etc. Those files are generated by Visual Studio whenever a solution is opened.
*.vb files are somewhat important since they contain your source code...
*.sln and *.vbproj files tell Visual Studio which projects are in a solution and which files are in a project, respectively. They also contain project specific settings such as build plattforms, custom build events, target .NET Framework etc.
*.resx and app.config can be important, depending on your project. They should not be left out when you publish your project, however since they're part of the Visual Studio project. If they're truly not needed you can remove them from the project.
Edit
Folders bin and obj are where Visual Studio generates the compiled output so you should not include those when you publish the source code of your project. Any other folders are project specific so it depends on your project if they're needed or not.
As a rule of thumb, anything that is automatically generated should be excluded when you publish your source code.
Also, if you don't already, you should use a version control system such as Subversion or GIT to manage your sources. Any essential files / folders as explained above should go in there.

vb.net auto detect dependency files for wix 3.7

I am in the process of learning WIX all thanks to MS for removing such a nice tool (vdproj) from the latest versions of visual studio.
I have come to know that I can add my files (and dlls) to distribute in WIX using that tag. It is OK. But in vdproj it was very easy to add all files. I just need to right click in file view, and select 'add project output'. This was enough to add dozen of files that were required for my application. In visual studio 2012, and using WIX 3.7, what options do I have to automatically list all those dlls that are required by my application?
There is no automatic method that could be written that wouldn't require you to remove some items and redirect some items to other folders. In the simple case, you wouldn't need an automatic method anyway.
In your WiX Setup project, add a reference to each project you want to include the output from. In the properties for a reference, set Harvest to True and Project Output Groups as desired.
Because project harvesting doesn't work in some corner cases, it is disabled by default. You must enable it in your project file. (See the references.)
Build and you will have ComponentGroups generated for your harvested projects. The script file is in the obj folder (since it's not a file you want to keep in source control).
For example, for the project ConsoleApplication1, add a ConsoleApplication1.Binaries ComponentGroupRef to a Feature. By default, all such components are placed into INSTALLFOLDER. If you want them elsewhere, you can change the ItemGroup metatdata or one of the properties that affect the HavestProjects target.
Unless you have many project references that change often, there is no need to automate this.
References: WiX.chm
HarvestProjects Target
Using Project References and Variables

Team Foundation Server - Committed files appear hidden for other TFS-Members

Since some months, we are using TFS 2012 with Visual Studio 2012 and until some weeks we didn't notice any problems during checking in/out. Furthermore, we are working on a ASP.NET MVC4 project.
But recently, we noticed that if Person A checks in new files (f.i. .cs or .cshtml) and Person B does "Get latest version", then he receives those files but they are hidden for some reason. So we have to do "Include in project" manually every time. This happens to any of us.
Neither I have direct access to the TFS configuration nor did I change my Visual Studio settings. Thus, it is really strange that this happens for no known reason.
Do you have any ideas what I should try or check?
The only time I have seen this kind of behavior is when someone checks in the files, but not the corresponding .csproj file. The .csproj file contains the definition of what files are included, so for the solution to build with the new files, the .csproj file must be checked in as well.
Note that it may be necessary on occasion to do a "Save All" before the changes to the .csproj file are committed.
I would recommend checking the .csproj file of the last few check-ins that have had this problem. I've encountered this any number of times when one of my co-workers "Excludes this file" from the project because they don't understand why something isn't working. They forget to re-include it in the project and then check everything back in. The project file doesn't contain the files that were excluded.