Giter Site home page Giter Site logo

Comments (7)

oleg-shilo avatar oleg-shilo commented on July 26, 2024

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="&quot;$(TargetPath)&quot; &quot;/MSBUILD:$(ProjectName)&quot;" 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.
image

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:
image

This is effectively what WixSharp.targets does.

from wixsharp.

dosarf avatar dosarf commented on July 26, 2024

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.

oleg-shilo avatar oleg-shilo commented on July 26, 2024

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.

oleg-shilo avatar oleg-shilo commented on July 26, 2024

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.

alexeygrant avatar alexeygrant commented on July 26, 2024

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.

oleg-shilo avatar oleg-shilo commented on July 26, 2024

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.

dosarf avatar dosarf commented on July 26, 2024

Thanks Oleg, for fixing the issue promptly.

from wixsharp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.