I am currently running into an issue where I have an mvc project and an API project in the same solution,Visual Studio 2017.
when I build the solution the structure is as follows
solution
solution/area1
solution/area2
solution/api
I am able to reach the api with no issues when just building on my local machine, but when I go to publish the solution the api project builds the dlls but does not build out the solution/api so I cannot navigate to my api calls.
I have tried setting up multiple start up solutions which did not resolve the issue.
When you build on your local machine, you probably use '(Re)Build solution', which builds all projects in the solution.
However, there is no such thing as 'Publish solution'. You can only publish a Project. When you do that, only the project and all its dependencies are built & published.
if your API is in a seperate project and not referenced from the MVC site, it will not be built nor published together with that MVC application.
There are two viable approaches:
You integrate the API in the MVC site (same domain, same routing mechanism, probably seperate area).
In that case I would suggest keeping it in the same project for simplicity.
You develop the API as a seperate application in its own (sub)domain.
Here you put it in its own project. And you build and publish it on its own, seperate from the MVC application.
msbuild MyProject.csproj /p:DeployOnBuild=true;PublishProfile=<profile-name>;Password=<insert-password>
https://stackoverflow.com/a/14232754/2183503 has the answer.
Note: It has some spurious information (regarding passing vs version) though. For example, I tested the command out out just now and it worked fine without the /p:VisualStudioVersion=11.0 in Visual Studio 2019 Developer Command Prompt.
Related
I have a ASP .NET Core 3.1 application which is hosted as a windows service using IHostBuilder.UseWindowsService call. I am preparing a setup project using Visual Studio Installer Projects Extensions. The project is created as Web Setup project type so that the installer dialog already presents to the user selection of web page and application pool on IIS.
The problem I'm facing is that the assemblies are successfully installed in given folder on IIS, but the ApplicationService.deps.json is not installed. Without this file the application does not start successfully. As far as I have checked the file is created as part of the build in bin\x64\Release\netcoreapp3.1\ but is apparently not included by the Setup project.
I've played around also with Setup project's property PublishProfilePath by specify the profile that I generated when manually trying to publish from Visual Studio to IIS:
However, this produces even stranger results. The application is deployed to the IIS already when I build the Setup project! Then when check the newly created msi, it's size is really small and in fact does not install anything (completes successfully though).
Any help would be highly appreciated.
I managed to solve the problem, though I'm not sure if that's the optimal solution. In the setup project, you can include as part of the output also individual files. If I add the ApplicationService.deps.json it is marked with a relative path in the setup project itself. This means that once setup project is being build, the ApplicationService project is anyway built first as it's the primary output of setup project. At that point `ApplicationService.deps.json' is present in the Release folder. Then as msi is being created it's included as part of the output.
It works, but I would prefer that the setup project would include that file automatically.
I'm trying to create exe/msi for my solution
it contains the following Projects
ActiveDirectoryEngine: library used to implement AD operations
ADService: windows service - performs the work in the background
CryptographyEngine: library used to encrypt/decrypt data
TerranovaActiveDirectoryHost: Dashboars/win form to manage/check the service's status
SyncToolSetup: the setup project "it only targets TerranovaActiveDirectoryHost"
Here is the contents of the Setup project:
I tried the same steps for different Solution, with ONLY one windows forms application, and it worked fine, but it looks that it doesn't work when I have more than one referenced projects.
The install and Uninstall options are not enabled
Update:
all the previous projects are referenced in the Win forms project, so am I targeting the right one when creating the exe/msi?
The only project with the Install option is the setup project. Other projects in the solution do not have install option just because there is a setup project as part of the solution.
References in a non-setup project (such as a C# build) are not automatically included in a setup project. References used to build code are not necessarily things that need installing on the target system. The setup will try to help with dependencies, but it's unreliable, and only a guide. For example, your Application Folder view contains some files that are part of the .NET Framework, and you definitely don't install them because they are installed as part of the standard .NET framework install.
The setup project must be told what needs to be installed on the target system. There are generally two ways of doing this:
Selecting project output as input to the setup project. This can be rather indeterminate because it's not always obvious what files are included, or what to do if the files need installing to different locations.
Add the files that you know you need one at a time by adding them in the File System view of the directory they need installing into. Typically, executables go into the Application Folder (defaults to Program Files..), data files to User's Application Data, shared files to Common Files folder, some assemblies to the GAC and so on.
We are a small team, working on a ASP.net Web Application project, following is the solution structure,
Solution:
Project: Data Access Layer
Project: Model Layer
Project: Business Layer
Project: Web Application Project
For source code repository, we are using Visual Studio Online, since team is small so we are using the Free version.
We are now trying to maintain the proper version for each release. Currently we publish (using publish tool Visual Studio) in a folder, then manually copy and paste files on server Website folder. So right now, the web application's DLL file is having version 1.0.0.0 all the time.
Now we want to use the VSO Build Feature, and each time when we run the build, we want this to happen.
Compiled website
Full code should (all projects) also be copied along with published files
The website DLL's build number should be increased automatically
I am NOT sure if all the above can be done on build or is there any other procedure. Can someone please point us in the right direction?
Thanks.
That can all be fine with the build on VSO. If you are using the XAML build you don't need anything else. Just configured a new build and out It at your solution. You will then get versioned output. To get the build output to have the version number incremented you will need to use powershell and call that during the build.
http://www.codewrecks.com/blog/index.php/2014/01/11/customize-tfs-2013-build-with-powershell-scripts/
I am adding an ecommerce section to an existing web application using NopCommerce (open source ecommerce package). Since the ecommerce section is logically different and Nop is built on MVC and my application is web forms I am keeping everything separate in my solution. When debugging locally I have all of the projects setup to use iis so I am able to debug them as a whole. All this seems to be setup good but when I go to publish the site I have to publish the three web apps (my app, nop, nop admin) separately. Is there something in vs2010 that I can use to publish all three applications at once? I guess it isn;t really that big of a deal but I would like to set things up correctly so any ideas, comments, or references would be great. Thanks!
I think it is not possible with Visual Studio environment but you can run the command line tool - aspnet_compiler from within the batch file.
Found an interesting blog-posts:
Web Deployment Made Awesome: If You're Using XCopy, You're Doing It Wrong
How To Create an ASP.NET Application from Multiple Projects for Team Development
VS 2005 Web Deployment Projects
ASP.NET Deployment Content Map
How to publish an entire solution as a single Setup file
I am using visual studio web project to install my web application and do some customization like modifying connection string in web.config file during install time.
Now, My requirement is to create a patch for the web application so that next time the web installer only the changed files.
Is there is any one to do it using visualk studio 2010 ide or any other way.We can't use third party products like Installshield,wix,innosetup etc.
Please suggest.
Visual Studio doesn't support patches for setup projects. It supports only major upgrades.
If you really don't want to use other setup authoring tools, you can try creating the patch manually. You can read more about this here:
http://msdn.microsoft.com/en-us/library/aa370578(VS.85).aspx
But it won't be easy.
If it is just Web project, I would recommend re-deploy instead of patching. Meaning you just deploy new version of site, above the previous one.
Except some really comprehensive case that strategy works all the time. I use simple xcopy deploy for all my projects.
You can write a mini C# app to do it. You can have the list of assembly files in a configuration. On loading of the app, it checks the timestamp difference between server and client files. On finding the change, the mini app pushes the changes file.
Hope, it will resolve your issue
There may be better suited solutins to deply websites than using an installer. For one, there's Web Deploy.
It's main purpose is deploying web applications to IIS and it allows you to modify key configuration values through a simple UI.
Web Deploy works with deployment packages; a big zip containing your application and some meta data to help install it. On deployment it will diff the deployed site with the data in the deployment package to update existing files, add new ones and remove obsolete files.
You can build deployment packages directly from Visual Studio and/or from MSBuild, using your favorite build server.
Web Deploy works really well when you need to deploy often or when you have to delegate deployment to IT staff.
Customizing Web Deployment package is a bit tedious though, you may find a blog post I wrote about this useful.
For simpler situations, I recommend good version control practices and xcopy deployment.
If you tag what you deploy to your server, you can zip up the changed files since last deployment and copy those to your server.