У меня ошибка при создании .vdproj на msbuild с помощью nant

Я привыкаю использовать nant для сборок. Но я начал использовать asp.net MVC, и я предпочитаю выполнить настройку для установки с помощью .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.

У кого-то есть подсказка или решение?

Если я воспользуюсь devenv, у меня будут проблемы?


person Custodio    schedule 24.09.2009    source источник


Ответы (4)


MSBuild не может создавать проекты .vdproj. Для этого вам следует использовать Visual Studio (devenv.com).

person Sayed Ibrahim Hashimi    schedule 25.09.2009
comment
... или перейти от проекта установки и развертывания Visual Studio .NET к WiX, который в любом случае будет поддерживаться в VS 2010. - person The Chairman; 25.09.2009
comment
ПОЧЕМУ MSBuild не может создавать проекты .vdproj? есть ли полная ссылка в MSDN? В любом случае, у Wix очень большая кривая обучения - person Kiquenet; 28.02.2017
comment
У @TheChairman Wix очень большая кривая обучения, а у Microsoft есть расширения Visual Studio для проектов установщика в VS 2013, VS 2015 и VS 2017. - person Kiquenet; 28.02.2017

Вот как я сделал это недавно, используя devenv, поскольку msbuild не поддерживает файлы .vdproj. Эта статья действительно помогла сначала обновить файл .vdproj: 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>
person CRice    schedule 22.07.2010
comment
@GarrisonNeely, вы пробовали какой-нибудь скрипт вроде %DevEnv% "%BaseSln%" /build "%BuildConfiguration%|%BuildPlatform%" /Project "%BaseVdproj%" /Out "vs_errors.txt"? - person Kiquenet; 28.02.2017
comment
Применяется тоже сценарий MSBuild (*.targets)? - person Kiquenet; 28.02.2017

К вашему сведению, это все еще не поддерживается в .NET 4.0

person Andrew Lewis    schedule 05.05.2010

Просто чтобы расширить сообщение CRise - создание проекта vdproj с использованием VS2010 devenv через командную строку не работает. Я считаю, что до 2010 года все работает нормально (см. текст ссылки)

person Siy Williams    schedule 23.07.2010
comment
Похоже, есть некоторые проблемы, я использовал 2008. Microsoft заявила, что текущая оценка исправления - середина августа. - person CRice; 30.07.2010