I have a error building a .vdproj on msbuild with nant
Asked Answered
S

4

6

I'm getting used to using nant for build releases. But I have started to use asp.net MVC, and i choice make the setup for installation with a .vdproj .

But, when I call the:

< exec program="${dotnet.dir}/msbuild.exe" commandline='"./Wum.sln" /v:q /nologo /p:Configuration=Release' />

in nant, my result is:

[exec] D:\My Documents\Visual Studio 2008\Projects\Wum\Wum.sln : warning MS
B4078: The project file "Wum.Setup\Wum.Setup.vdproj" is not supported by MSBuild
and cannot be built.

Someone have some clue, or a solution?

If I use the devenv, I'll have a problem?

Sorption answered 24/9, 2009 at 14:32 Comment(0)
D
7

MSBuild cannot build .vdproj projects. You should use Visual Studio (devenv.com) for this.

Disaster answered 25/9, 2009 at 2:19 Comment(3)
... or move from Visual Studio .NET Setup and Deployment Project to WiX which is going to be supported in VS 2010 anyway.Shamrao
WHY NOT MSBuild cannot build .vdproj projects ? any full reference in MSDN ? Anyways, Wix has very huge learning curveOocyte
@TheChairman Wix has very huge learning curve and Microsoft has Visual Studio Extensions for Installer Projects in VS 2013, VS 2015 and VS 2017Oocyte
S
10

Here is how I did this recently using devenv as msbuild will not do .vdproj files. This article really helped with updating the .vdproj file first: http://www.hanselman.com/blog/BuildingMSIFilesFromNAntAndUpdatingTheVDProjsVersionInformationAndOtherSinsOnTuesday.aspx

<target name="someTarget">
    <!-- full path to setup project and project file (MSI -> vdproj) -->
    <property name="DeploymentProjectPath" value="fullPath\proj.vdproj" />
    <!-- full path to source project and project file (EXE -> csproj) -->
    <property name="DependencyProject" value="fullPath\proj.csproj" />
    <script language="C#">
    <code>
      <![CDATA[
        public static void ScriptMain(Project project)
        {
            //Purpose of script: load the .vdproj file, replace ProductCode and PackageCode with new guids, and ProductVersion with 1.0.SnvRevisionNo., write over .vdproj file

            string setupFileName = project.Properties["DeploymentProjectPath"];
            string productVersion = string.Format("1.0.{0}", project.Properties["svn.revision"]);
            string setupFileContents;

            //read in the .vdproj file          
            using (StreamReader sr = new StreamReader(setupFileName))
            {
                setupFileContents = sr.ReadToEnd();
            }

            if (!string.IsNullOrEmpty(setupFileContents))
            {
                Regex expression2 = new Regex(@"(?:\""ProductCode\"" = \""8.){([\d\w-]+)}");
                Regex expression3 = new Regex(@"(?:\""PackageCode\"" = \""8.){([\d\w-]+)}");
                Regex expression4 = new Regex(@"(?:\""ProductVersion\"" = \""8.)(\d.\d.\d+)");
                setupFileContents = expression2.Replace(setupFileContents,"\"ProductCode\" = \"8:{" + Guid.NewGuid().ToString().ToUpper() + "}");
                setupFileContents = expression3.Replace(setupFileContents,"\"PackageCode\" = \"8:{" + Guid.NewGuid().ToString().ToUpper() + "}");
                setupFileContents = expression4.Replace(setupFileContents,"\"ProductVersion\" = \"8:" + productVersion);

                using (TextWriter tw = new StreamWriter(setupFileName, false))
                {
                    tw.WriteLine(setupFileContents);
                }
            }
        }
       ]]>
    </code>
    </script>

    <!-- must build the dependency first (code project), before building the MSI deployment project -->
    <exec program="Devenv.exe" commandline='"fullPath\solution.sln" /rebuild "Release" /project "${DependencyProject}" /out "fullPath\somelog.log"'/>
    <exec program="Devenv.exe" commandline='"fullPath\solution.sln" /rebuild "Release" /project "${DeploymentProjectPath}" /out "fullPath\somelog.log"'/>
</target>
Shovel answered 22/7, 2010 at 7:13 Comment(2)
@GarrisonNeely did you tried any script like %DevEnv% "%BaseSln%" /build "%BuildConfiguration%|%BuildPlatform%" /Project "%BaseVdproj%" /Out "vs_errors.txt" ?Oocyte
Applies too MSBuild script (*.targets) ?Oocyte
D
7

MSBuild cannot build .vdproj projects. You should use Visual Studio (devenv.com) for this.

Disaster answered 25/9, 2009 at 2:19 Comment(3)
... or move from Visual Studio .NET Setup and Deployment Project to WiX which is going to be supported in VS 2010 anyway.Shamrao
WHY NOT MSBuild cannot build .vdproj projects ? any full reference in MSDN ? Anyways, Wix has very huge learning curveOocyte
@TheChairman Wix has very huge learning curve and Microsoft has Visual Studio Extensions for Installer Projects in VS 2013, VS 2015 and VS 2017Oocyte
W
3

FYI this is still not supported in .NET 4.0

Weaner answered 5/5, 2010 at 20:44 Comment(0)
M
1

Just to expand on CRise's post - building a vdproj project using VS2010 devenv through command line doesn't work. Pre-2010 works fine I believe (see link text)

Millsaps answered 23/7, 2010 at 16:8 Comment(1)
Looks like there are some issues, I was using 2008. Microsoft have stated "The current estimate for the hotfix is mid August."Shovel

© 2022 - 2024 — McMap. All rights reserved.