How to set the startup project for an asp.net core template? - asp.net-core

I am currently creating a multi-project template, I want to distribute using a .VSIX-extension for Visual Studio. When the extension is installed the user can select my template among the others provided by Microsoft in the "Create a new project" window.
My template consists of three project:
ProjectName.Server
ProjectName.Contract
ProjectName.Client
ProjectName is the user-given name while the suffixes "Server", "Contract" and "Client" are fixed. The issue I experience is that when the users create a new project the Client-project is always selected as a startup-project by default. I want the server-project to be selected as a startup-project by visual studio. It looks like following:
The client project is not the correct startup project, but users don't know that the server project it the correct startup project, so I want to take off the selection and integrate it right into the template, so the correct startup template is selected by VS when creating the project.
I already removed the suffix "Server" from this project, so it is shown as the first project in the solution explorer and I hoped VS would then select it as the startup-project. This did not work unfortunately.
Can anyone give me a hint on how to configure the startup-project in the template?
If you have any questions don't hesitate to comment.

These configurations are stored in the Solution User Options (.suo) file.
You can refer to my steps below to try:
First, Close Visual Studio and find the folder where your solution is.
Second, Open the .sln file with a text editor, you see all your projects encapsulated in Project – EndProject lines:
Third, Cut and paste the desired default startup items into the first.
Fourth, Delete your .suo file(hidden files: Solution Folder/.vs/Solution Name Folder/v17/.suo, I use VS2022).
Finally, Open your solution in Visual Studio.
You can have a try.

You will likely need to associate a custom IWizard assembly with your project template, and then explicitly set the startup project by setting the SolutionBuild.StartupProjects to the desired project in your solution.
Once upon a time, I did this using code similar to the following:
VSProject startupProj = FindVSProject(startupProjName);
sln.SolutionBuild.StartupProjects = startupProj.Project.UniqueName;
where FindVSProject was implemented as:
private VSProject FindVSProject(string projName)
{
foreach (Project p in _dte.Solution.Projects)
if (p.Name.Equals(projName, StringComparison.CurrentCultureIgnoreCase))
return p.Object as VSProject;
return null;
}

Related

Adding DLL reference to VB.NET project

Just to start off, this question does seem very similar to another post Add the DLL (lame_enc.dll) reference to my project, but I haven't been able to successfully apply that answer. I am pretty new to VB.NET so it is very possible I'm simply missing something obvious.
I am trying to link a DLL to a VB.NET 2010 project to allow my VB app to play *.ogg files. I followed some other advice here on the forums and downloaded FMOD's FMOD Ex Programmers API. I am trying to now reference that functionality. These appear to be the files I need to somehow reference.
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex64.dll.
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\libfmodex64_vc.lib.
I haven't discovered how to add a *.lib reference (or the equivalent), but selecting the DLL as a reference gives the following error.
A reference to 'C:\Program Files (x86)\FMOD SoundSystem\FMOD
Programmers API Windows\api\fmodex64.dll' could not be added. Please
make sure that the file is accessible, and that it is a valid assembly
or COM component.
I'm not sure what I could be missing. Any ideas? Thanks!
In Solution Explorer, double-click the My Project node for the project.
In the Project Designer, click the References tab.
Click the Add button to open the Add Reference dialog box.
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
Select the components you want to reference, then click OK.
Another approach I was trying is working for me. I found a site with a working example of a LibZPlay VB.NET sample ( http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=7789&lngWId=10 ). It runs under VS 2008 and I was able to adapt my project to use LibZPlay (open source library http://libzplay.sourceforge.net/WELCOME.html ) under VS 2008.
That is sufficient for me for now. Thanks for your advice. It was likely some configuration issue or misunderstanding on my end.
Using VB.net 2015 I (could not add or even find a System32 dll) as a reference using Solution Explorer, Tab References. Going to the MAIN Menu, Projects/Add References...
Used Browse and All the System32 dll were visible. Then I was able to load the needed dll.

Merging two VB.Net Projects

we are new to Visual Basic Programing, We are working on a project, which has modules. My team worked on these modules and prepared 3 separate Visual Studio Projects. Now, I want to combine then into one Visual Studio Project for Integration purposes.
We are using Visual Studio 2010.
In the solution explorer window (Default is top right) you will need to:
Right click on your Solution
go down to Add
select Existing Project
This will pop up a windows browser window, you will need to navigate to the place that you have the files saved, then click Open
Repeat steps 1-4 for all subsequent items.
Based on what you are saying, it sounds like youll need to add references to the modules in the main project:
Ensure that you are viewing all files in your solution by selecting Show All Files in the Solution Explorer
go down to References
click Add Reference - a window will pop up
in the top left, select Projects
in the popup window Right click on the Name of the project and select Add Reference
You should be good from here.
Your question is not clear wether or not you want to add the code from the individual projects to one project or add your projects to one solution.
In the first instance use the project that you want to be the main project and right-click on the project and select add existing item to select the .vb module file that you want to add.
In the second instance create a blank solution File -> New Project -> Other Project Types -> Visual Studio Solutions -> Blank Solution, then right-click on the new solution and select Add -> Existing project to add your projects

Unable to use ObjectListView

I just downloaded ObjectListView. After adding the dll file when the objectListView is placed on my vb.net form it shows an error
Type 'BrightIdeasSoftware.ObjectListView' is not defined.
How to solve this problem ?
I am using VS2010
It sounds like you are missing a reference.
If you added the project source code, then you need to right-click on the project and select Add Reference..., select the Projects tab, and choose the ObjectListView project.
If you are just using the DLL, then you need to right-click on the project and select Add Reference..., select the Browse tab, and select the DLL file.
Update
Based on the screenshot, the issue is that ObjectListView requires the full .Net Framework, not the client profile.
To resolve this, right-click on the project, select Properties, then select .Net Framework 4 in the Target framework dropdown list (it will currently be set to .Net Framework 4 Client Profile).
I just downloaded the full demo package and verified that it would run. I then went to the Toolbox Right-Clicked and Selected Choose Items... under .Net Framework Components I then browsed to the folder that has the ObjectListView.dll in it and selected it. This added the component to the Containers group on the Toolbox. I then added ObjectListView to my form and it worked correctly. Check and make sure your project references have ObjectListView in them.
i.e.

Importing VB.net project A into VB.net Project B

Could someone point me in the direction of importing a project into a project. Any information on how to use it would be great as well.
For example I have Project A that I could use to work within Project B. I have no idea what the correct form is for calling this in.
Any links would be more than helpful as well.
I am working in VB 2010
First Edit:
I do have an add reference option, but no add project option. Im assuming i shall go with reference and see what I can do.
Right click on the solution in the Solution explorer and Add --> Existing Project should work
Or file from the main menu Add --> Existing project

Stop showing SQL errors in Visual Studio 2010

How can I stop VS2010 showing errors in .sql files, attached to a project? I don't want to check them at all, just C# code. The files are used as resources, Build Action set to Content. I'd like to keep .sql extension for syntax coloring purpose.
Regards,
Looks like your question was answered here: https://stackoverflow.com/a/8593877/2798869:
Visual Studio 2010
Tools -> Options -> Text Editor -> Transact-SQL -> IntelliSense
Uncheck "Enable IntelliSense".
Visual Studio 2012 & 2013
Tools -> Options -> Text Editor -> SQL Server Tools -> IntelliSense
Uncheck "Underline errors"
Note that you have to close then re-open any .sql files you may have open.
In VS 2012.
Go to the sql file properties in VS.
Under "Advanced", change the "Build Action" option to "None".
Unfortunately you have to do this for each sql file in the project.
This is what gave me the behavior that I wanted. It not only compiles without errors but shows no sql related build errors.
Update
It is possible to select multiple files in Solution Explorer by using Shift + Click (select the file at the top of the list -> hold down shift -> click the file at the bottom of the list). Once you have selected the group of files, you can then change the Build action to None for all of them at once. (This worked for me in VS2013.)
While you still have to select files per folder you don't have to select each file to set the property.
VS2015
right click in editor of the sql file > Intellisense Enabled
May be a sledge hammer to the problem but I manually deploy my SQL changes and only use them to house the scripts for my builds, so I do not need the functionality provided by SQL Projects.
Open the VS Solution File properties (right-click the solution in VS Solution Explorer and select Properties) and in the left pane select "Configuration Properties" -> "Configuration". In the right-pane you will see the projects in the solution. Un-check these projects to prevent them from building, this will prevent them from showing errors.
Is it possible you have a .cs extension on those files but it's not shown? I added some .sql files to my project and the compiler is not complaining.
Change the type of files to content and then the intellisense will never try and parse the contents of the files.
I just built a test project with one class file .cs and added one .sql file. It automatically set the build type to content. It built fine like John Fraser said in VS2010, so I changed it to compile, and obviously it failed.
This isn't the answer yet but perhaps the next step is to try and create a new solution, and import a few of the files from the original project to try to narrow down the source of the problem. If it builds then it would tell you it is something about the settings in your project/solution. Otherwise it could also be a VS setting.
Steps to stop showing SQL errors in bulk:
Open the SQL project file which has the .sqlproj extension in a text editor.
Find and replace <Build Include= with <None Include=. (This one has the same effect as right-clicking and changing Build Action to None in the solution explorer.)
The SQL errors should disappear in Visual Studio.