How to add "visual studio"-reference to WIX in Visual Studio 2010? - visual-studio-2010

I've got a solution with many projects and WIX setup project. I'm using WIX 3.5.
One project (that is referenced from WIX setup project) contains a reference (an ordinary reference in VS) to:
C:\Program Files\WPF Toolkit\v3.5.50211.1\WPFToolkit.dll
(simply: setup project --- reference --> another project in solution --- reference --> WPFToolkit.dll; note that the "references" are not the same - the first one is some kind of WIX specific reference and the other is ordinary reference in Visual Studio)
I thought that maybe the line (automatically generated) in setup project:
<ComponentGroupRef Id="Product.Generated" />
may solve it for me (i.e. includes also WPFToolkit.dll in installer) but it doesn't.
Obviously, I can add the file manually in my wxs file but it will be harder for maintenance.
Is there a better solution?
Thanks!

If you want your install project to be more extensible when adding new WiX Files to a Component, I would suggest to create an external tool (could be a c# console app) to handle the WiX Files generation and add them to your install project. This tool can have a config file where you can setup which WiX Files correspond to each Component.
This tool can be added to an Automated Build process.

What you are seeing is an initial attempt to do exactly what you want via the WiX toolset. On the Property Grid for References to other projects in your .wixproj, you should have the ability to control "Harvesting" and what project output groups are harvested. Unfortunately, there are still some bugs in the feature so it doesn't always work.
If you want to get your hands dirty you can look at the Heat project harvester and how it gets wired into the .wixproj.

Related

Plugins and Sandboxing - Add reference to another project in solution

I have a plugin assembly I have registered to D365 CDS(cloud) and it runs fine.
I want to reference and use some classes in a separate project included in my solution in Visual Studio.
Adding the project as a reference will give File Not Found exceptions. I am able to add the individual classes using the Add Existing Item - Add Link option, but I would like to do it as a whole project reference instead of individual links. Is that possible without using ILMerge and how would I accomplish that?
As I mentioned in my comment, I create a SharedProject in Visual Studio (2017). I put all my Business Logic into this Project (or Projects).
Then I can have a "Workflow" and a "UnitTest" project that each refer to that Shared Project.
More Info

How to "force the WiX .exes to run out-of-process"

There is a bug in the WiX plugin for Visual Studio where file locks on referenced DLLs are not properly released. Therefore, you have to restart Visual Studio every time you want to recompile a custom extension DLL or any assembly referenced by it.
This is a known bug, but the issue was closed because there seems to be a solution / workaround:
You can force the WiX .exes to run out-of-process to avoid the lock
MSBuild has.
I don't understand how to achieve this. I checked...
the properties of my WiX setup project
the properties of the extension assembly (C# class library)
all Visual Studio settings
the available command line arguments of candle.exe
...but did not find anything. What am I missing? How do I apply this workaround?
I'm using WiX 3.10 and Visual Studio 2013.
The example that I've seen several times around the web is to add <RunWixToolsOutOfProc>true</RunWixToolsOutOfProc> to the Wix Installer's project file within a property group. Unfortunately, documentation of this feature has thus far eluded me.

Building MSI from TFS Build

I am trying to build MSIs in a TFS Build by shelling out to DEVENV.exe (since MSBUILD does not support VSPROJs). In any case, my first installer project builds fine, the second one fails. If I reverse the order, same thing happends (i.e. the error does not follow the project). Looking at the output, I get the following errors:
Deserializing the project state for project '[MyProject].dbproj'
[MyProject].dbproj : error : Error HRESULT E_FAIL has been returned from a call to a COM component.
Also, I get:
Package 'Microsoft.VisualStudio.TestTools.TestCaseManagement.QualityToolsPackage, Microsoft.VisualStudio.QualityTools.TestCaseManagement, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' failed to load
It looks as though the first build tries to serialize the DB project (and it says it succeeds, but there is no DBML file anywhere). Then the second build tries to deserialize the DB project and fails.
I've tried resetting env settings (using the /resetusersettings flag) as well as using the /resetskippkgs flag. Nothing works.
Any ideas?
When you shell out to DevEnv, are you building that specific project (.vdproj file), or are you building the solution? It sounds like VS is trying to open the solution on the build machine and the database and test project systems aren't present.
Have you considered porting your setup project to WiX?
Start simple. Unless you're well versed in the problem you're trying to solve it's usually best to try it "by hand" before getting it running as part of a TFS build. RDP into the build server and try running the necessary commands at the command line and see what happens. You can even go simpler than that and RDP into the build machine and load Visual Studio and build it.
Bottom line is that if you can't get it to build within Visual Studio or at the command line by calling devenv.exe it won't work as part of the team build.
I am using the below Exec task to do precisely what you are doing as part of a TFS build. So I know this works. Your platform and configuration may vary depending on what you're building. The nice thing about this is that you'll have a log file at C:\Temp\MSIBuildOutputLog.txt that you can analyze for additional errors and information.
<Exec Command=""C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" "$(PathToSolution)\solution.sln" /Build "Release|Mixed Platforms" /out "C:\Temp\MSIBuildOutputLog.txt"" />
One important thing to note... There is a bug in VS2010 which causes MSI generation to fail when you try to run it at the command line using devenv.exe. This took me days to find and figure out, but you need this hotfix. Worked like a charm...
http://archive.msdn.microsoft.com/KB2286556
Actually it's the deployment projects that don't support msbuild. FWIW, this is all deprecated in the next release of Visual Studio so you might want to start looking at InstallShield Limited Edition and/or Windows Installer XML now before spending too much time on dead end, broken technology. Both of these alternatives have proper MSBuild support aswell as many other improvements.
It would be perhaps better and quicker to adopt WIX (Windows Installer XML) which is the technology MS now recommends to use within VS/MSBuild/TFSBuild environment to crate MSIs.
It is relatively easy to setup and integrate within your VS Solutions. It uses XML based files to describe your MSIs and uses these files to create your MSIs when you compile.
I would start by downloading Wix from http://wix.codeplex.com/
Once installed you would be able to use the VS2010 integration of Wix based projects to create MSIs. To get started quickly simply add a new Wix project to your solution and reference the projects whose output you wish to combine into an MSI. Next you can run a tool called "Heat" which is included with Wix toolkit to generate the XML files by scanning your projects.
Once you have these XML files, add them to your Wix project and compile.

After migrating a VS 2005 project to VS 2010, I have web references causing troubles

I have a winform project build on VS 2005 and framework 2. Recently, we moved to VS 2010, but keeping the framework v2 as target.
Everything runs fine except my web references.
When I update the web references, a new file "Reference1.cs" is created, under the reference.map file. This is causing troubles as original "Reference.cs" is still here and all classes are duplicated.
Here is the project structure :
My winform project
Web references
MyWebServiceReference
WebService.disco
webservice.wsdl
Reference.map
mycomplextype.datasource
Reference.cs
Reference1.cs
On the reference.map file, I have a custom tool defined : MSDiscoCodeGenerator. This custom tool seems to throw a warning :
Warning 1 A custom tool 'MSDiscoCodeGenerator' is associated with file 'Web References\MyWebService\Reference.map', but the output of the custom tool was not found in the project. You may try re-running the custom tool by right-clicking on the file in the Solution Explorer and choosing Run Custom Tool.
If I run the custom tool, the file reference1.cs is generated...
thanks in advance for the help.
I would try deleting the web reference and re-adding instead of updating.

Visual Studio - SharePoint 2010 - Include Assembly > Quick Question

I have a quick question....building a VS 2010 SharePoint project and I am referencing a custom assembly. I can reference this assembly in my code and it works fine to write code and all. When I deploy the project to SharePoint my Feature Activation code will not run because the custom assembly does not get deployed with the project.
I have set Copy Local to TRUE on the referenced assembly. Am I missing something?
Thanks
When you Create SharePoint Project in Visual Studio 2010, you will see a Item called Package in it.Click open it and bottom left corner click on Advanced, you will see an option to add additional assemblies , add as many you want > all assemblies you select here will get deployed as a Part of SHarePoint Package you create.
Not sure if this is what you're looking for, but you can use ilmerge.exe to bundle satellite managed assemblies into your executable, making it portable and more easily deployed. I use it all the time, it works great.
You can set up a build event in VS2010 to do this automatically whenever you build, too, though it can be a bit slow (I have it set as a Release-only build event for this reason).

Resources