Visual Studio build and deploy ordering - sql-server

We have a VS 2010 solution that includes a few class library projects, a SQL Server 2008 database project and a Wix setup project. We are trying to get to a point where the following happens in the order specified:
Build the class library projects and the database project
Deploy the database project to generate the deploy .sql script
Build the Wix setup project.
The reason for the desired order is that the setup project requires the deployment .sql scripts as it will use these to generate/update the database on the machine that the msi is run.
It seems that there is no way within a Visual Studio solution file to create this type of build/deploy/build order. Is this correct?
Thanks

You could change the BeforeBuild target of the Wix project (*.wixproj) to deploy the database project before the build:
<ItemGroup>
<DatabaseProject Include="../Database1/Database1.dbproj"/>
</ItemGroup>
<Target Name="BeforeBuild">
<MSBuild Projects="#(DatabaseProject)"
Targets="Deploy"
Properties="Configuration=$(Configuration);Platform=$(Platform)"/>
</Target>

How are you building it? You can change the build order in a solution from Visual Studio, granting you build it from Visual Studio. In Solution Explorer go to Build Order or so.
If you do it from command-line/MSBUILD you can build the first, then the second and the last project, easy, just call MSBUILD on each project, in the desired order. Thought there should be a finer control, I don't remember.
EDIT: It's called "Project Build Order", under the the solution node, it activates when you have more than 1 project in the solution.

I have tried this and get an error when I tried to reload the project after editing. However ignoring the error and reloading the project again worked fine and indeed building the Wix project triggers a deploy of the database project.

Related

Visual studio pack NuGet without building folder

I have a working visual studio 2019 project with a simple nuget package, where if I right click 'ClassLibrary2' and click 'pack' it packages my project into a NuGet package
I want to package this folder NxTestware, when I include the folder in my project and try to pack again, it results in errors that come from inside the source folder, like it is trying to build the contents of that folder
Is there some way in visual studio I can tell it that when I click 'pack', do not build the contents of the NxTestware folder?
After trying I can't reproduce your issue on my side, please check your project's csproj file, and refer to this document: How to: Exclude files from the build.

How can I build a Wix project on a remote build server?

I have a Wix installer project for my WPF application, and I am trying to integrate this project into my CI/CD pipeline (Github Actions). Currently, I don't know how to build this project on the build server. The Wix documentation says that I could just check-in the Wix tooling with the actual source code, but this seems like a bad idea. What is the most recommended way of building WiX projects on Github Actions or more generally on a remote build sever?
GitHub Actions Windows environment already has WiX installed along with VS.
So to build your WiX projects (*.wixproj), just use the typical MSBuild command msbuild A.wixproj.

How to include Publish profile and application parameters in a package of service fabric application for deployment?

I am trying to package Service fabric application, when i do that i have application manifest and service manifest files but i want to include application parameters and Publish profiles as well.
Not sure what CI system you're using but typically there's three parts to make it all work
Package your application output + manifests. This is basically the package location output you get from doing an MSBuild on your sfproj. In below, I'm assuming CI build artifact output go to '$(build.artifactstagingdirectory)'
/t:Package /p:PackageLocation=$(build.artifactstagingdirectory)\applicationpackage
Include a step in your CI build output to copy the the parameter and profile files to another folder - e.g. $(build.artifactstagingdirectory)\projectartifacts
**\PublishProfiles\*.xml
**\ApplicationParameters\*.xml
Deploy your application. For this, have a look at the Deploy-FabricApplication.ps1 script that's created by Visual Studio when your first created your .sfproj Service Fabric project. This is also used by Visual Studio when you deploy your application to your local development cluster and you essentially have to perform the same steps to deploy to another cluster.
A simple example assuming your CI artifact output exists in "$(SF_PackagePath)"
Deploy-FabricApplication.ps1 -ApplicationPackagePath "$(SF_PackagePath)\applicationpackage" -PublishProfileFile "$(SF_PackagePath)\projectartifacts\Local.1Node.xml"

DNN module development

I have a client with dnn website. I need to develop module for it. How I can start? I'm using Microsoft Visual Studio 2010 now (trial version). I cannot access source code, just make new module and install it. What is the best practice to start on the environment like this? Other question is if I using trial version of visual studio, is my module will expire too?
These materials, especially video tutorials, might be really helpful to you when getting started with DNN module development: http://www.dotnetnuke.com/Resources/Wiki/Page/Module-Development.aspx They cover every part from installing DNN module project templates to development and packaging of the custom DNN module.
To your second question, the answer is no, your module will not expire after VS2010 trial expires. Another option for you is to use free express editions of visual studio 2010, for this case Visual Web Developer 2010. You can download it here: http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-web-developer-express You will not be able to use source control directly from express edition, but still there is option to use SVN and a client like TortoiseSVN.
Purchase and read this book: Professional DotNetNuke Module Programming
Visit the download page of DotNetNuke.com
Download the Community Edition. Install it on your dev machine, get it working.
Hook the Desktop Modules folder and bin folder (at least) to your source control
At the download page above, install the Visual Studio Starter Kit
Restart Visual Studio 2010
Start up Visual Studio 2010, create a new compiled DNN module project, make sure its location is in the Desktop Modules folder of DNN
Implement some test code
Install the module on DNN (install by manifest)
Add the module to a DNN page. Test it.
Make updates to your DNN module. You only need to uninstall and reinstall the module if you add or remove files or change the database setup scripts.
Build a deployable version of your module. (You make a zip file or something. Just read the book. I always have to refer back for this step)
Practice installing the DNN module on another fresh DNN Community Installation.
Once you are satisfied that it is installing correctly, install the module on the live site (Do backups first, just in case)

Silverlight 4, RIA Services & TFS 2010 Build Server

I have a Visual Studio 2010 solution file with a number of projects in it. There is a mix of Silverlight projects (acting as modules), the Silverlight Shell project and a number of RIA services.
When using TFS 2010 to perform the build, it always fails because the proxy classes generated by the RIA services have not been built first. The only solution I have seen so far is to manually change the build order in my .sln file. No thanks, there are loads of projects.
Rather than break the solution up in to client side and server side solution, I'd like to find a better solution.
Apparently MSBuild 4 ignores the build order in the .sln file.
Does anyone have any ideas/suggestions?
Thank you,
The simplest way I've found is to declare explicitly the dependency between Silverlight project and the project that is hosting RIA service.
You have to open in a text editor your Silverlight project file and add a fragment to it:
<ItemGroup>
<ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
This will tell msbuild to build your web service before building your Silverlight app. And it will work only when building with msbuild, VS will throw an error.
To get it built in Visual Studio also, you have to wrap this fragment in a Target and add it to InitialTargets in Project node:
<Target Name="MySpecialReferences">
<ItemGroup>
<ProjectReference Include="..\Path\Your.Hosting.Project\Your.Hosting.Project.csproj">
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
</ProjectReference>
</ItemGroup>
</Target>
<Project ... InitialTargets="MySpecialReferences" ... >
Visual Studio 2010 will skip this target now but msbuild will use to change built order of projects.
This definitely doesn't seem to be the "proper" solution, but as an interim option what about checking in the generated Generated_Code\*.g.cs files for your RIA services present in your Silverlight projects? If people check in the up-to-date version along with the matching updates to their DomainService classes, all should build as expected.
Below is a sample from an MS Build script that we're using in our project. Basically, we've labelled our web project (containing the RIA services) as a priority project and are building it first.
Please note that the 1st XML tag should be located somewhere in the environment setup stage.
<ItemGroup>
<!-- use this collection to control project build order, projects listed in this array are removed from the current build queue and pushed in the front before compilation-->
<InitialBuildProjects Include="MyProject.Web.RiaServices" />
</ItemGroup>
<ItemGroup>
<PriorityProjects Include="$(ProjectRootDirPath)\Sources\%(InitialBuildProjects.Identity)\%(InitialBuildProjects.Identity).csproj" />
<RemainingSourceProjects Include="$(ProjectRootDirPath)\Sources\**\*.csproj"
Exclude="#(PriorityProjects)" />
<SLTestProjects Include="$(ProjectRootDirPath)\Tests\*.Web\*.Web.csproj" />
<BuildQueue Include="#(PriorityProjects);#(RemainingSourceProjects);#(SLTestProjects)" />
</ItemGroup>
Works for us in private builds + on our TeamCity server.
Does this help ?

Resources