Показаны сообщения с ярлыком Visual Studio. Показать все сообщения
Показаны сообщения с ярлыком Visual Studio. Показать все сообщения

21.09.2021

.NET: compiling single file executables in .NET 5

 .NET 5 is not a very new technology, very soon MS will perform release version of .NET 6. Hovewer 5th version is still in use and not all problems were solved in it. One of such problems is compiling single file executables. If you try to do it just by selecting checkbox in publish settings window, just like you did for .Net core 3.1 and ealrlier, it will not work. Visual Studio will still compile multifile build. 

Here is a workaround for it. You will need to manually add properties (PublishSingleFile, SelfContained, IncludeAllContentForSelfExtract and RuntimeIdentifier) in your project file. Thus you csproj will look like this:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <OutputType>Exe</OutputType>
        <OutputType>WinExe</OutputType>
        <TargetFramework>net5.0-windows</TargetFramework>
        <PublishSingleFile>true</PublishSingleFile>
        <SelfContained>true</SelfContained>
        <IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
        <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    </PropertyGroup>
</Project>

Of course your parameters (like runtime or generated file type) may be different according to your task.

12.07.2013

Visual Studio 2012 Update 3 released

Not so much time passed after Update 2 was released and now MS introduces us Update 3 for Visual Studio 2012. Updates description can be viewed here.

Download new update from the Microsoft site, use this link.
If you want to save the whole package for future installations you have to run exe with key "/layout", i.e. you will have the following command "VS2012.3.exe /layout". When installation begins you will be prompted to set the package path in your file system. Nevertheless you can just use iso which MS guys have specially prepared for you.