Comments (7)
It's interesting one.
The key to the problem is understanding why TeamCity prevents WiX source generatione. And another question is why is it a problem.
Wix# compiler will always generate *.g.wxs files if it was invoked with /MSBUILD param. And the out dir is a relative path (./wix) with respect to the CurrentDir. Both command line param and CurrentDir are set by the MSBuild via WixSharp.targets:
<Exec Command=""$(TargetPath)" "/MSBUILD:$(ProjectName)"" WorkingDirectory="$(ProjectDir)"/>
If TeamCity does not fully respect MSBuild runtime model and tweaks with the environment (e.g. sets its own CurrDir) the generation of *.g.wxs can be compromised. Thus in your case the files may still be generated but not in the place you expect. Solution (if this behavior needs to be solved) is to ensure TeamCity executes msbuild target (WixSharp.targets) correctly.
Though I am not sure that *.g.wxs files is a problem. These files are marked in the "no action". Thus their absence does not affect the build outcome at all.
Thus I am afraid you need to do some TeamCity investigation.
If you hit the wall you can always get rid of WixSharp.targets and do the build an old fashioned way. Have just an ordinary ConsoleApp project, add NuGet WixSharp.bin and add post-build event:
This is effectively what WixSharp.targets does.
from wixsharp.
The workaround I just found: make sure your folder wix\ exists under your project (e.g. have it created prior to invoking msbuild) - then the Wix# generated exe will indeed always produce the .g.wxs file, and things work. If the folder wix\ is not there neither it or the .g.wxs file will be created. This way you can mark the .g.wxs to be gitignored.
I am very far from being an expert in VS matters, but this smells like as if the generated exe would not be creating the wix\ folder, merely using it (by putting the .g.wxs file there). And that makes me wonder how the item in the ItemGroup: < None Include="wix$(ProjectName).g.wxs" /> got to my .csproj file. Is that something that gets added when you include the Wix# NuGet packages somehow, together with the WixSharp.targets? Could the difference be that VS re-creates wix\ folder if missing, and msbuild does not?
from wixsharp.
Excellent. Thank you for sharing.
The problem was caused by the Wix#-MSBuild building algorithm not recreating the wix
folder if it was deleted for whatever reason.
The problem has been fixed in the latest Release v1.4.0.
A new settings has also been introduced to allow extra MSBuild control. Now you can suppress *.g.wxs generation when required (e.g. TeamCity builds):
static void Main()
{
// suppress generation of .\wix\MyProduct.g.wxs
MsBuild.EmitAutoGenFiles = false;
...
from wixsharp.
And that makes me wonder how the item in the ItemGroup: < None Include="wix$(ProjectName).g.wxs" /> got to my .csproj file. Is that something that gets added when you include the Wix# NuGet packages somehow, together with the WixSharp.targets?
Correct. And now you can control the inclusion with the it with the MsBuild.EmitAutoGenFiles
setting:
static void Main()
{
// suppress generation of .\wix\MyProduct.g.wxs
MsBuild.EmitAutoGenFiles = false;
...
from wixsharp.
Hi Oleg,
Thanks a lot for fixing the issue!
I can now ignore *.g.wxs files without breaking TeamCity builds, that's a good news.
from wixsharp.
Not a problem,
It was dosarf
who identified the cause of the problem. Most likely TeamCity does some sort of directory clearing and removes the wix
folder.
Keep in mind that MsBuild.EmitAutoGenFiles
just ste's/gets a process envar WIXSHARP_SuppressMSBuildAutoGenFiles
and nothing else.
Thus you can remove MsBuild.EmitAutoGenFiles
from your code and set the envar globally (e.g. on TeamCity build PC):
set WIXSHARP_SuppressMSBuildAutoGenFiles=true
This in turn will unconditionally suppress the *.g.wxs creation for all Wix# projects on your build PC and yet if the same code is compiled on a dev PCs a *.g.wxs will be generated to assist you with the development.
from wixsharp.
Thanks Oleg, for fixing the issue promptly.
from wixsharp.
Related Issues (20)
- Mainteance dialog (Change enabled button) HOT 2
- Transfer wix v3 Localization to V4 Loc in Wix# HOT 8
- %AppData% folder no replace by path wix4 HOT 4
- How to localization for Embedded WPF UI MSI HOT 9
- CA Name in Installprocess in V4 HOT 2
- Change installation content based on user inputs HOT 2
- When selecting different installation directory, subfolders still get installed in default directory HOT 2
- [INSTALLDIR] subdirectories question HOT 2
- Recurisive Add all Files and Subfolders HOT 3
- Externl Ui and Silent intallation HOT 7
- BA Installer with multiple MSI's Trouble HOT 4
- Repair not working HOT 25
- Add Custom WPF Dialog to Setup HOT 5
- Upgrade Project with BA Installer from .NET 4.8 to NET 8.0 or better HOT 5
- Problem installation in %AppData% Wix 4 WPF HOT 17
- Application folder is not removed after uninstallation HOT 9
- WixSharp NET Core UI Project HOT 3
- Write Filename with Path on InstallDialog HOT 24
- SetVersionFromFileId not working for relative path in Managed Project Dir HOT 3
- Azure pipeline build HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wixsharp.