Unable to create new build configuration - c#

Here's an annoying one.
I have a solution in Visual Studio 2012 that contains a .Net 4.5 class library, a .NET 4.5 web application and a .NET 4.5 website.
I want to create a new build configuration, let's call it Publish or Live, mainly so that I can select it when publishing the web application and use a web.config transform.
So I click my Solution, go to Build then Configuration Manager. In the configuration dropdown, I choose , and I get the little popup asking me for the name of the new configuration etc. I fill this in, click OK, and......nothing. Nada.
No matter what I call the new configuration, whether I choose to copy from an existing configuration etc, no new configuration is created. Am I missing something blindingly obvious?
Thanks,
Matt

I had the same issue, but when I deselected 'create new project configurations', I was able to create a new solution configuration.

I recently had the same problem. I figured out that VS 2019 doesn't like it to have projects grouped in an project folder (virtual folder) which is named the same way as the project is. Or where the "virtual" folder name has the same name as an actual project
Example:
(virtual) project folder name: CompanyName.Webservice
Content: CompanyName.Webservice (from CompanyName.Webservice.csproj)
In that case I couldn't neither add or rename project configurations nor execute transformation of web.config files of that project
Hope that helps someone after so many years...

If you cannot find solution configuration settings on the Standard toolbar or cannot access the Configuration Manager, you may have Visual Basic developer settings applied. For more information, see How to: Manage Build Configurations with Visual Basic Developer Settings Applied.
Link : http://msdn.microsoft.com/en-us/library/kkz9kefa.aspx
Solution :
Link : http://msdn.microsoft.com/en-us/library/ms165414.aspx

Related

Setup C# solutions startup projects in a configuration file

I have a solution with 4 projects in it. I wish to start them all.
For example, I had somebody new clone by work. This means that startup projects wouldn't be configured. However what I want is a file that defines what startup projects should be set when you run for the first time.
From what I found this information is written by Visual Studio to *.suo file in .vs directory that Visual uses to store some user solution settings and options.
Maybe you could develop Visual Studio extension that could persist selection of start up project. You can find some information here.
More about .suo file in this SO post.
Solution explorer > "yourcoolprojectname" right click> properties> common properties> multiple startup project> choose projects

Microsoft Visual Studio not showing intellisense when typing in app.config for creating ServiceHost

I am new to WCF( Windows Communication Foundation) services. When I am typing in app.config to do the configurations while creating a host console application, such as defining endpoints, Microsoft Visual Studio 2012 does not show any intelli-sense.
The issue may result in typing wrong tags and the application not to build successfully.
Seems like I have to install something first. Can anyone shed some light on this issue?
You probably don't have the service model XML schema loaded. To load them open your app.config file in Visual Studio, an additional menu named XML should appear, click it and open Schemas..., and check you have all the basic schema loaded.
Additionally, most of the schema files are found in your VS installation directory\VS version\xml\Schemas\ folder.
Yes, u are right f.nasim.
I think its because I did not load namespace ,System.ServiceModel , in my project.
While implementing the next tutorial, I did not get this issue.

C# How to install Windows Service as part of application installation

I have created an installer that takes the primary output from a selection of sub-projects, one of the sub-projects that make up my application is a Windows Service. This service needs to be installed as part of the main application.
So far I have tried adding an installer to the Service project, publishing this separately and installing the resultant Setup.exe as a custom action for the project installer but have not had any success with this method. I would install the thing from the command line, however I'd need to then package in the Visual Studio CMD Tool to get access to the installutil command.
My question is, can I install a Windows Service from a "Visual Studio Installer - Setup Project" as part of a larger project and if so how? As the process has eluded me thus-far.
I suppose I could try having the custom action trigger a script that executes the ServiceInstaller as part of the process, so I'll be trying that.
Thanks in advance
Since VS2013 does not contain the old (VS2010) Visual Studio installer project, I have these suggestions:
Use WiX installer: https://wix.codeplex.com
There is even a service installer template (not tested):
https://visualstudiogallery.msdn.microsoft.com/7f35c8ce-1763-4340-b720-ab2d359009c5
Use VS 2013 install extension
There were many complaints that MS abandoned the old setup project, so they brought it back as an extension:
http://blogs.msdn.com/b/visualstudio/archive/2014/04/17/visual-studio-installer-projects-extension.aspx
I have not yet tested this, but as I understand it, it will bring back the old capabilities of the internal VS setup project type.
I have written some Windows services using VS2010 setup project and even wrote a step-by-step instruction how to do this. Some steps are not self-explanatory, so I use this myself as a guide for service projects.
I did some first tests with WiX, which seems a good solution, however I had not yet used that for service installation.
Another link regarding this topic:
https://superuser.com/questions/727643/installing-a-windows-service-without-visual-studios-installutil-exe
I plan to check my step-by-step instructions regarding service installation with VS2013 soon and probably compare this to WiX, if you are interested, please tell me, I can make this publicly available.
Here are my step-by-step instructions for creating a Windows service.
(you can find this also on http://www.rsprog.de/samplewindowsservice)
File => New => Project...
Visual C# => Windows Desktop => Windows Service
Name: SampleService
"Create directory for solution" checked
In Solution Explorer, select Service1.cs, right-click => Rename
Rename file to SampleService.cs
Select Yes for "... Would you also like to perform a rename ..."
SampleService.cs should be shown in Design View now
Click in the background of the designer view
right-click => Add Installer
(serviceProcessInstaller1 and serviceInstaller1 have been added)
open SampleService.cs in design view
in Properties, set ServiceName to SampleService
open ProjectInstaller.cs in Design View
Click serviceInstaller1
In the Properties window, set the ServiceName property to SampleService.
Set the DisplayName property to Sample Service or something else
(This will be shown later in services console as service name)
Here you can also optionlly set StartType from Manual to Automatic
click serviceProcessInstaller1
Edit Account:
Here you can change if the service will run under a technical account (User)
or e.g. as LocalSystem
If you set it as User, a popup during setup will allow user / password to be set
At Solution right-click => Add => New Project...
Other Project Types => Visual Studio Installer => Setup Project
Name: SampleServiceSetup
Select SampleServiceSetup project, right-click => Add => Project Output...
As Project "SampleService => Primary output" should be already selected,
as Configuration "(Active)" should be already selected.
Press OK
Select SampleServiceSetup project, in properties view:
change InstallAllUsers to True
change ProductName to SampleService (remove Setup at the end)
change Title to SampleService (remove Setup at the end)
By default, the target platform of the setup project is x86.
You can change it here to x64 (TargetPlatform)
Right-click the setup project in Solution Explorer => View => Custom Actions
In the Custom Actions view, right-click the Custom Actions node => Add Custom Action...
Double-click the Application Folder in the list to open it,
select Primary Output from SampleService (Active), and click OK.
("Primary output from SampleService (Active)" was added to the four nodes)
Select SampleServiceSetup project, right-click => View => User Interface
Start => Installation Folder => Properties => InstallAllUsersVisible: change to False
Build solution
Windows Installer has a mutex that prevents multiple installations from running at the same time. For this reason one installer can't call another installer. There's an exception to this but the resulting pattern can't be installed silently and is not a best practice.
You need to research the concepts of a bootstrapper / chainer. InstallShield has one they call suite installers and Windows Installer XML (WiX) has one called Burn.
Also Visual Studio Installer projects are well known by Windows Installer experts for their low quality. I'd consider rewriting that installer using another tool such WiX. I maintain an open source project called Industrial Strength Windows Installer XML (IsWiX - CodePlex) that provides project templates (scaffolding) and graphical designers that make it possible to author an MSI that installs a service without writing a single line of XML by hand. The resulting project is then built by WiX to create an MSI.

WPF adding references broken after moving project

I have a solution consisting of a WPF app. After some juggling of dir paths I cannot add references to my projects anymore. Whenever I do "add reference" in visual studio 2013 I get an error:
Cannot locate resource 'shared/standardresources.xaml'
I can build the solution just fine in VS.
Due to company policy the structure of my solution is like this (note the src dir):
x.sln
src/wpfApp/wpfApp.csproj
However, it turns out I get the same problem even if I just create new project in the default place in a new solution. I can reproduce the problem as described above like this:
Create a blank solution
In Windows Explorer create a src directory in the solution
In VS, Add a new WPF Application to the solution. Store it underneath the src dir created previously.
Now try adding references to the WPF Application by right clicking it in Solution explorer. The error message appears.
Any help would be appreciated. Thanks.
To the noobs like myself out here you can try to move the projects into the new src folder and add the projects back into the solution. Also, verify you are using the absolute correct version of the dlls. Wrong versions can occur when setting up a new development machine. (Making certain the most current and correct libraries are on the new machine is one more reason to "image" a known good dev harddrive as a baseline.) Edit the project file and look at the references version="value" and compare to the installed components.

Windows Service not appearing in services list after install

I've created a windows service in C#, using Visual Studio 2008
I pretty much followed this:
http://www.codeproject.com/KB/dotnet/simplewindowsservice.aspx
I created a setup project, as instructed to in the article, and ran it...
it installs my service to C:\Program Files\Product etc.... however, it does not then appear in the services list..
What am I missing?
The most important part of the article you linked, is here
To add a custom action to the setup project
1.In Solution Explorer, right-click the setup project, point to View, then
choose Custom Actions. The Custom
Actions editor appears.
2.In the Custom Actions editor, right-click the Custom Actions node
and choose Add Custom Action. The
Select Item in Project dialog box
appears.
3.Double-click the application folder in the list box to open it, select
primary output from MyNewService
(Active), and click OK. The primary
output is added to all four nodes of
the custom actions � Install, Commit,
Rollback, and Uninstall.
4.Build the setup project.
If you skip these steps, your setup project will build and copy your files to the correct directory; however, they will not register your binary as a service without these steps.
I should also note that this works for older versions of Visual Studio that had/have the built-in Setup/Deployment project template. The newer versions of Visual Studio have different setup/deployment projects (some requiring third party software.)
I'd recommend looking into WiX Toolset and check here for WiX Installation of Windows Services.
I got owned in the face by this one, so I'm putting it here just in case anyone else runs into it.
If you followed the instructions in the guides but are still having issues installing, ensure your Installer class is public. Internal won't work.
I had this same issue and then I realized that I never set the parent for the ServiceInstaller.
Double-click on your project installer. The designer should show a Service Installer and Process Installer. When you click on either and view the properties you should note the Parent attribute which must both be set to the class name of the Project Installer.
Or, if you do it in code, make sure you set:
serviceInstaller.Parent = this;
and
serviceProcessInstaller.Parent = this;
When installing services, I would highly recommend using NSSM, which worked well for me for all my WinService needs. It can install any executable (even if .bat, .cmd) as a service, and guarantees your service is always up and running.
To use this tool:
Download from here
And follow the instructions here
Then check the services list, it should be there, up, and running.
Follow these instructions, they worked for me. For the setup specifically, that part is near the bottom of the article.
MSDN: Walkthrough: Creating a Windows Service
In Visual Studio 2013 I ran into the same problem using InstallShield template for service application. But it works like charm when using Setup Project template https://visualstudiogallery.msdn.microsoft.com/9abe329c-9bba-44a1-be59-0fbf6151054d
so download Setup Project template close your Studio, run this installation and start your Studio, this will work.
Dunn.
Here is a good tutorial from tgeek001 from CodeProject.com that helped me. It includes several things I didn't see in the posts above:
1. Event handler code to stop the service before uninstalling it
2. Specific conditions and properties in the Custom Actions code to set in order to prevent failures (these fixed the Error 1001 that I experienced while following the instructions in the accepted answer above)
3. Win Service property "Remove Previous Version" dropdown set to true
http://www.codeproject.com/Tips/575177/Window-Service-Deployment-using-VS
The following is from the tutorial for Custom Actions Settings (case matters):
Install, set the Condition property to the following: "NOT (Installed or PREVIOUSVERSIONSINSTALLED)"
Uninstall, set the Condition property to: "NOT UPGRADINGPRODUCTCODE"
Commit: set "Custom Action Data" field to: /OldProductCode="[PREVIOUSVERSIONSINSTALLED]"
Lastly, in the WinService project, make sure to set the dropdown "Remove Previous Versions" to true.
cheers
I discovered that your installer class much be in the same project as the Service. The installer cannot exist in a library project referenced by the Service.
remember to check the name you've given your service before you search. (right click-> properties->check the service name

Categories