Как обновить решение и файлы проекта из командной строки
Я тестирую бесплатное программное обеспечение с открытым исходным кодом, используя Visual Studio 2015 Community Edition ( и здесь), чтобы обеспечить совместимость с компилятор и инструменты. 30-дневная пробная версия истекла, поэтому мне нужно работать из командной строки, потому что среда IDE существует после того, как сообщила мне, что пробная версия истекла:

Когда я пытаюсь запустить msbuild из командной строки, я получаю пару ошибок верхнего уровня:
Описанные выше проблемы связаны с решением более низкого уровня (Visual Studio 2008) и файлами проекта.
Официальная документация находится по адресу Как: обновить Visual C++ Projects to Visual Studio 2015, но на странице не обсуждается обновление решения из командной строки.
Согласно блогу команды VC++ по адресу Руководство по обновлению проекта Visual Studio 2010 C++, VCUpgrade.exe находится в $(VSInstallDir)\common7\Tools . Но: «. [VCUpgrade.exe] подходит только для обновления приложений только с одним проектом, поскольку он не может принимать файл решения в качестве входных данных и анализировать информацию о решении в файлах проекта.»
Я также нашел Обновление проектов до Visual C++ 2010 по адресу Создание приложений, использующих Windows SDK. Он говорит мне использовать devenv.exe /upgrade . Когда я следую его инструкциям, это приводит к следующему. Ошибок не было, но ничего не конвертировалось (и лог-файл не создавался).
Попытка использовать VCupgrade.exe (даже несмотря на то, что это неполное решение в соответствии с документами Microsoft) приводит к:
Как преобразовать решение и файлы проекта из более ранней версии Visual Studio в Visual Studio 2015?
Есть несколько похожих вопросов, но они не касаются командной строки с такими ошибками, как «Не удалось инициализировать VCProjectEngine» и [необъяснимым] истекающим пробным периодом. См., например, Обновление решения Visual Studio из командной строки с помощью Visual Studio Express.
С юмором (в болезненном смысле) Microsoft называет Visual Studio 2015 Community бесплатным инструментом разработки и не указывает срок действия пробной версии на Обзор продуктов Visual Studio 2015 или Сообщество Visual Studio. На самом деле, Microsoft сообщает нам, что он полнофункциональный и бесплатный для проектов с открытым исходным кодом (каким является этот проект).
Я предполагаю, что Microsoft солгала, и юристы где-то похоронили это в Условиях обслуживания. Более того, ни «пробная версия», ни «истечение срока действия» не упоминаются и не упоминаются в Условиях обслуживания. См. условия лицензии сообщества Visual Studio от Microsoft.
Не так уж смешно, но я отказался от копии Visual Studio Professional после изучения маркетинговой литературы Microsoft, потому что я думал Community Edition, которая удовлетворит потребности проекта. Я надеюсь, что это не окажется ошибкой в 500 долларов США.
How to update .sln (solution) file within Visual Studio 2019
I am clean build -ing and rebuild -ing the project I am working with and I keep getting errors that is is unable to find the path/folder/filename because I ended up updating the name within file explorer.
I want to open the projectname.sln file and update the file path manually.
My current workaround is to right click .sln file and open with VS Code. Do my edits and then save. After saving it causes a trigger to reload in Visual Studio
Как обновить решение visual studio 2019
Как обновить все проекты решений .Net Framework 4.5.1 до 4.8 Visual Studio 2019
У меня есть решение в Visual Studio 2019 со многими проектами C #. Мне нужно перенастроить все проекты с .NET Framework 4.5.1 на 4.8. Можно ли изменить цель сразу или я должен сделать это отдельно с каждым из них?
PS: я пробовал «TargetFrameworkMigrator», но он не работает с (VS2019) / .net 4.8.
Спасибо за вашу помощь.
3 ответа
К сожалению, VS не предоставляет простой способ для .NET Framework, и каждый файл проекта имеет свои собственные настройки. Поэтому, возможно, самый простой способ — «Редактировать -> Найти и заменить -> Заменить в файлах» в каталоге в VS или любом другом текстовом редакторе, который вам нравится.
Для проектов Framework в каждом .csproj вы хотите <TargetFrameworkVersion>v4.8</TargetFrameworkVersion> (из <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion> ), если у вас есть packages.config , есть targetFramework=»net48″ (из > ) . Вам нужно будет перезагрузить решение после изменения VS, чтобы увидеть их.
Так что я прошел PR на Git, так что вы не одиноки. Кто-то уже опубликовал пакет выпуска, который работает для .NET 4.8 с VS2019
Вот ОТКРЫТЫЕ PR, которые ждут слияния
выпуск для VS2019, который фактически работает, в соответствии с коммитом и комментариями. Попробуй
Обновите решение Visual Studio и файлы проекта программно
У меня есть много проектов визуальной студии, которые доставляются клиенту с помощью установщика. После установки все файлы проекта и решения должны иметь последнюю установленную визуальную студийную версию. Есть ли способ конвертировать много проектов быстро?
Я пробовал следующее:
1) разбор файлов и замена различных свойств, таких как ToolsVersion и т.д. Он быстрый, но не надежный и должен быть изменен для каждой новой Visual Studio, которая выходит на рынок (ежегодно с AFAIK)
2) Используя функцию обновления evvenv, надежно, но ОЧЕНЬ медленно:
3) Пытался создать скрытый экземпляр VS и манипулировать решениями там, как описано здесь, но не повезло.
Таким образом, можно быстро и надежно обновить многие файлы проекта/решения до определенной версии Visual Studio?
1 ответ
Позвольте мне представить вам другое представление, чем представленное вами 2. Тот факт, что обновление медленное, заключается в том, что все виды проверок выполняются над проектами/решениями, которые вы пытаетесь обновить. Для получения отзывов об этих проверках создается «Отчет об обновлении». Это информация, которую нельзя игнорировать, поскольку она предоставляет средства защиты по указанным вопросам.
Вы заявляете, что развертываете проекты/решения через установщик. Предполагая, что у вас есть команда разработчиков/инструменты, которые являются актуальными, вы можете выполнять обновления как часть дизайна/разработки вашего установщика. Почему бы вам не выполнять обновления самостоятельно и не включать файлы проекта в ваш установщик. Во время установки вы должны установить версию файлов проектов/решений, которые соответствуют целевой платформе.
Guide — How to Update Visual Studio to a New Version in Windows [MiniTool Tips]
How to update Visual Studio 2022/2019/2017/2015/2013 to a new version to gain a better experience? It is a simple way and you can follow some ways given by MiniTool to easily do the update operation.
Visual Studio is an integrated development environment (IDE) designed by Microsoft and it is used to help develop PC programs including mobile apps, web services, web apps, and websites. For .NET and C++ developers, it is a comprehensive IDE. It is also a standalone source code editor that can work on Windows, macOS, and Linux. If you want to edit, debug, and build code, and then publish an app, Visual Studio is a good option.
Currently, Visual Studio 2022 is the latest product and old products like Visual Studio 2013, 2015, 2017, and 2019 are also available to download via Microsoft’s official website.
If you are using one of them with an old version, you can choose to upgrade Visual Studio to the latest version to enjoy more features, security fixes, and improvements for a better experience. For Visual Studio 2022 Community/Professional/Enterprise, the latest version is 17.4 when we write this post.
Visual Studio update is a simple thing and you can follow several ways below to do this task if you need. Let’s move to the next part to find what you need.
![]()
Is IntelliSense not working in Visual Studio or Visual Studio Code? Take it easy and try multiple ways here to fix this issue on a Windows 11/10 PC.
Updates to setup projects
This article explains how to install a new version of your setup project using the Windows Installer update mechanism.
Third in a series on Visual Studio setup
This article explains how to install a new version of your setup project using the Windows Installer update mechanism.
Introduction
When you need to build a new version of your setup project or ship fixes to it, it’s tempting to rebuild the project and try to install the MSI file. Doing so, however, typically launches a message box indicating that another version of the product is already installed and directing you to the control panel to uninstall it.
The primary reason for this is that the ProductCode Guid identifies the product to Windows (see the setup project properties in Figure 1). Since you have already installed the product identified by that Guid, you must use a Windows Installer update mechanism to install a new version of your product.
How to update your product
Visual Studio supports the RemovePreviousVersions project property mechanism in its IDE. Figure 1 shows that the value is false. When you’re ready to build a new version of your product to replace an older one, follow these steps:
- Increment the version property (see Figure 1). Visual Studio displays a message box that prompts you to change the ProductCode and PackageCode. Select yes.
- Set the RemovePreviousVersions property to true.
Setting the RemovePreviousVersions property to true removes previous versions of the product from the system as you install the new version. Since products are identified by the ProductCode Guid, changing the ProductCode creates a new product. That is, the old product is uninstalled as you install a new one. Note that the version property, which becomes the Windows Installer ProductVersion property, is a key piece of data that relates to updating your product. It is not simply a descriptive string.
Figure 1 also shows a DetectNewerInstalledVersion property that checks, at install time, to see that you’re not trying to upgrade an existing installed version with an older version.
Before describing how RemovePreviousVersions works, I’ll explain how PackageCode and ProductCode interact.
PackageCode, ProductCode and repair
The PackageCode is a Guid that uniquely identifies the MSI file from which a product was installed. When you install an MSI file, the PackageCode and ProductCode are recorded on the system. When you attempt to install another MSI file, the PackageCode and ProductCode interact in two ways:
-
If the new MSI file has the same ProductCode and PackageCode as a product that’s already installed, Windows indicates that you must repair or remove the product (see Figure 2) Remove uninstalls the product, but repair can be more confusing.
You cannot set the PackageCode property (Figure 1). Instead, Visual Studio generates a new one when required.
When a product is installed, Windows caches a copy of the MSI file in the Windows\installer folder and records the location from which the MSI was originally installed. The cached MSI file contains the data from the original MSI file but does not contain the actual files, so it can be used to check that the product is installed properly. If there are any missing files, Windows will go to the recorded install location to retrieve the installation MSI file. If a repair is triggered, Windows may ask for the original CD or network location.
The product upgrade
Another Guid, the UpgradeCode, recognizes that a previous version is installed (see Figure 1). When RemovePreviousVersions is set to true, Visual Studio builds an MSI file that checks for other installed products with the same UpgradeCode and uninstalls them. This is known as a Windows Installer major upgrade.
The upgrade uninstalls the older product and then installs the new one, so everything that was installed in the older version will be uninstalled. It does not update files with newer versions. If data files were installed that the user may have updated, they will be uninstalled.
You may need to take this behavior into account when you build the first version of your installation package. It may be better to have your application produce data files at run time, for example, rather than adding them to the setup. This ensures that RemovePreviousVersions will not uninstall them, and they will carry over into the next version of the product.
Everyone or just me?
At install time, the dialog box in which you choose the installation folder is also where you set the “Everyone” or “Just me” radio-button choices (see Figure 3). In Windows Installer terms, it’s a choice between a per-machine install (for all users of the system) or a per-user install (for the installing user). An Everyone install does not upgrade a Just me install, and vice versa.
There is no way to preset the Everyone/Just me setting in Visual Studio 2003’s IDE. Figure 4 shows the properties of a setup project in the Beta 1 version of Visual Studio 2005. Note that there is an InstallAllUsers property to set the default behavior.
Be mindful of the issues
The internal logic that uses UpgradeCode to search for other versions of the product allows a range of version values to be used. A tool called Orca in the Windows Installer section of the Platform SDK can be used to view and edit MSI files. More on this later.
Figure 5shows the values in the Upgrade table in the MSI file. The VersionMin and VersionMax values show the range of values for which to search, but Visual Studio does not allow you to specify this version range, which starts at 1.0.0. If you are partial to versions before 1.0-0.5, for example-your RemovePreviousVersions will fail.
Recall that a Just me install will not upgrade an Everyone install. In Visual Studio .NET, the internal search for a matching UpgradeCode occurs before the per-machine/per-user value is resolved. In Visual Studio setups the default install is per user, so a RemovePreviousVersions upgrade will not upgrade an Everyone per-machine install because it is still in the default per-user mode when it searches for the previously installed versions. Visual Studio 2003 does not have this issue.
Custom actions in RemovePreviousVersions upgrades may also give unexpected results. In a Windows Installer major upgrade, custom actions are called in the same process space.
Let’s walk through the scenario with a DLL, including .NET assemblies. The first custom action called will be the uninstall custom action from the older, already installed version. Windows loads the associated DLL and calls the custom action. Later, the install custom action from the new product is called. If this DLL has the same name as the DLL in the older product, Windows assumes that the DLL is loaded and it will not load the version of the DLL from your new setup.
This has some interesting effects. The install method from your old custom-action DLL is called instead of the one from the DLL in the new setup. Similar problems have been reported with COM DLLs. So although it might be awkward, I recommend that you change the name of your DLL in these cases. See http://support.microsoft.com/default.aspx?scid=kb;en-us;555184 for additional information.
Other types of updates
Products can be updated using Windows Installer patches, or MSP files. The main advantage of such patches is that they are small. The patches function as a delta between one version of an MSI file and another-the difference between the MSI tables-and new versions of the updated files. In the optimizations that produce the smallest patches, the patches contain binary patches to individual files. In cases that are less optimized for size, patches contain the entire file that has changed.
Patches can be built using PCP files, described in the Windows Installer SDK documentation. I don’t recommend that you build patches based on setups that were generated by Visual Studio setups, however, because you don’t have enough control over the way Visual Studio generates MSI files. In particular, the generation of patches is sensitive to the name of the internal CAB file and associated streams embedded in the MSI file. A mismatch between old and new versions will give you error 2356 when you apply the patch.
Expert mode
The great thing about Visual Studio setup projects is that they isolate you from the complexities of Windows Installer: You don’t need to worry about what’s going on internally. There are other tools that enable you to control more of the internals of MSI setups and give you the proverbial rope with which to hang yourself (see http://installsite.org/pages/en/msi/authoring.htm for a good summary).
The reason that setup programs require extra care in design and implementation is best illustrated by comparing them with other programs. A typical application program processes input data and produces some result for consumption by humans or other programs. If it breaks, you replace it on the system by putting a new copy out there.
An installation program isn’t like that. It makes changes to the system, many of which are in sensitive areas such as the Windows registry. Once those changes have occurred, it’s too late to replace the setup program with a new one because the changes, and the damage they may have done, are already on the system.
Perhaps the closest analogy to a setup program is an application program that updates a critical database. If the program breaks, the database is corrupted and you need to restore a previous version of the database or find a way to undo the damage.
If you want to learn more about what goes on inside MSI files, take a look at a tool called Orca from the Windows Installer section of the Platform SDK. If you install from Orca.msi in the \bin folder, you will see the tables and their contents in the MSI file.
I use the word tables because the MSI file is a database, and the tables and their uses are documented in the Platform SDK. MSI files are transparent-you can see everything except for the content of binary files used in the custom actions that Visual Studio generates. To see what happens, take a look at the InstallExecuteSequence table of an MSI file in conjunction with a log from installing that MSI file with this type of command line:
Обновите решение Visual Studio и файлы проекта программно
У меня есть много проектов визуальной студии, которые доставляются клиенту с помощью установщика. После установки все файлы проекта и решения должны иметь последнюю установленную визуальную студийную версию. Есть ли способ конвертировать много проектов быстро?
Я пробовал следующее:
1) разбор файлов и замена различных свойств, таких как ToolsVersion и т.д. Он быстрый, но не надежный и должен быть изменен для каждой новой Visual Studio, которая выходит на рынок (ежегодно с AFAIK)
2) Используя функцию обновления evvenv, надежно, но ОЧЕНЬ медленно:
3) Пытался создать скрытый экземпляр VS и манипулировать решениями там, как описано здесь, но не повезло.
Таким образом, можно быстро и надежно обновить многие файлы проекта/решения до определенной версии Visual Studio?
1 ответ
Позвольте мне представить вам другое представление, чем представленное вами 2. Тот факт, что обновление медленное, заключается в том, что все виды проверок выполняются над проектами/решениями, которые вы пытаетесь обновить. Для получения отзывов об этих проверках создается «Отчет об обновлении». Это информация, которую нельзя игнорировать, поскольку она предоставляет средства защиты по указанным вопросам.
Вы заявляете, что развертываете проекты/решения через установщик. Предполагая, что у вас есть команда разработчиков/инструменты, которые являются актуальными, вы можете выполнять обновления как часть дизайна/разработки вашего установщика. Почему бы вам не выполнять обновления самостоятельно и не включать файлы проекта в ваш установщик. Во время установки вы должны установить версию файлов проектов/решений, которые соответствуют целевой платформе.