Visual Studio 2022 can't create exe with all dll's - c#

I have project in .NET 4.8 and i want to publish as one exe file (with all dll) and app.config. When i use VS 2017 i just choose publish and to file. But now i have Publish wizard which create installer (which install i don't know where). When I go to project properties this same wizard.
Edit: this issue absent for .net 6 app
Publish Wizard which I get:
P.S. I hope my english wasn't too terrible

Publishing in a single-file app isn't supported by .NET Framework 4.8. This is for .NET core and higher version of launguage.

Related

Using VS 2017 image, unable to build other projects in a solution which has one .NET Core 3 project

I have a solution with multiple projects, one of which targets .NET Core 3.
I need to build another project in the solution using both the VS 2019 image and the 2017 image. For the 2017 image, I don't need to build the .NET Core project; so I've disabled the build on that project using the VS Configuration Manager. However, the build still fails:
C:\Program Files\dotnet\sdk\2.2.108\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets(137,5): error NETSDK1045: The current .NET SDK does not support targeting .NET Core 3.0. Either target .NET Core 2.2 or lower, or use a version of the .NET SDK that supports .NET Core 3.0.
[C:\projects\antlr4parsetreevisualizer_visualizerTestCore_visualizerTestCore.csproj]
because of that one project.
How can I tell AppVeyor to ignore the project in this instance?
I tried explicitly setting the build: project: element, but to no avail.
appveyor.yml
We are going to add .NET Core 3.0 to Visual Studio 2017 image in the next update (https://github.com/appveyor/ci/issues/3158). In the meantime, you can use the following script to install .NET Core 3.0 during the build:
install:
- ps: Invoke-WebRequest -Uri 'https://dot.net/v1/dotnet-install.ps1' -UseBasicParsing -OutFile "$env:temp\dotnet-install.ps1"
- ps: '& $env:temp\dotnet-install.ps1 -Architecture x64 -Version "3.0.100" -InstallDir "$env:ProgramFiles\dotnet"'
Regarding project exclusion - I believe you can disable project building for specific configuration in Visual Studio IDE ("Configuration manager..."). However, for .NET Core projects I'd recommend going away from building a solution to building particular projects with dotnet build .... Additionally, if you need to publish .NET Core app publishing solution won't work with dotnet publish command.
Initially, I only had one .csproj file to build per configuration. Per build image, I passed the project to dotnet restore (in my case I also had to rework the matrix logic to depend on the appveyor_build_worker_image environment variable):
environment:
matrix:
- job_name: VS 2019 build
appveyor_build_worker_image: Visual Studio 2019
- job_name: VS 2017 build
appveyor_build_worker_image: Visual Studio 2017
# ...
for:
# ...
-
matrix:
only:
- appveyor_build_worker_image: Visual Studio 2017
configuration: ReleaseCI2017
build:
project: 2017\2017.csproj
before_build:
- cmd: dotnet restore 2017\2017.csproj
Once I did that, everything seems to work, even without downloading+installing .NET Core 3 in an install script.
appveyor.yml
Thread on AppVeyor support forum
But as it turned out, I needed to build two projects for each image. I've resolved this by using additional solution files to control which projects should be built under each image, instead of relying on the VS configuration manager.
I then pass each solution to the build: project element, and AppVeyor will only attempt to build the specific projects referenced by that solution.
appveyor.yml
AppVeyor log.

Adding .NET Core to prerequisites in visual studio 2017 setup project

I'm making an application in Visual Studio 2017 using .NET Core 2.1 and I need to create a setup for it. I installed Visual Studio Installer Projects and created the setup project. I want to add .NET Core to prerequisites so it will be installed along with my app.
When I right click on the setup project and pick properities -> prerequisites I see only different versions of .NET Framework. Is there a manual way of adding the prerequisites to the setup project so that I could attach .NET Core to the setup?
As I mentioned I am using Visual Studio Community 15.9.11 and Visual Studio Installer Projects v0.9.1.
[UPDATE]
The app was written using .NET Core 2.1 and I can set it as the target framework. The only place where the .NET Core is not visible is the screen for prerequisites in setup project properities. Here is where the .NET Core is missing.

The target process exited without raising CoreCLR started event error with .NET Core 2.2

I want to debug an empty WebApi Project based on .NET Core 2.2.
I installed the "Core 2.2 SDK x86" and changed the target framework to 2.2:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
</PropertyGroup>
When I started to debug this project, IIS starts, but in the route api/values I see nothing (it loads forever) and I get this error:
The target process exited without raising a CoreCLR started event.Ensure that the target process is configured to use .NET Core. This may be expected if the target process did not run on .NET Core
In my solution WPF and Class Library projects exist. I wanted to make a WebApi for it. Like I said, it's an empty base project generated by Visual Studio 2019. I just installed Core 2.2. Why do I get that error and what am I doing wrong?
I had the same issue.
I ran Program.cs file from the command line and the error message was different.
So, apparently, I didn't have the appropriate .NET Core runtime installed.
You can download it by the following link - https://dotnet.microsoft.com/download
I was facing the same issue!
I updated my Visual Studios to the most recent via the VS Installer.
While updating, I also added the following VS Workloads:
ASP.NET and web development
.NET desktop development
See about workloads here:
https://github.com/MicrosoftDocs/visualstudio-docs/blob/master/docs/install/modify-visual-studio.md
This worked for me! 😊
I did not have to downgrade or remove anything
I had to do a "clean" and "rebuild" of the project and after that it worked again.
I ran with the same problem. But for me it was that my project was running in .NET Core 2.2, which I didn't have installed. I'm using VS 2019.
So for the solution, just go to Visual Studio Installer and for your VS 2019 hit "Modify" like in the following image (it's in spanish though):
Then, click "Individual Components", like
And then, make sure you checked in ".NET Core 2.2 Runtime (EOL)" (and above like .NET Core 3.0, if you want) and click "Modify", as shown
Hope this works for you.
In my case, switching to x64 save the day.
It seems like there are lots of different causes for this. For me, it was because I had upgraded a .csproj file but I hadn't updated the image used in my docker file.
I had same issue after package upgrading. You don't need any vs update.
Just go to
dotnet.microsoft.com/download/dotnet-core/2.2
and get runtime
dotnet-hosting-2.2.7-win.
I had the same error. Remove "Microsoft.AspNetCore.All" from dependencies.
I have downgraded "Microsoft.AspNetCore.App" version and error gone .
Deleting all bin folders of my solution
building everything again did the trick for me
(.NET Core 3.1 VS 2019)
I see many answers like try and error
after searching about the issue, I got the following :
it simply depends on three parameters and they have to be compatible
Windows platform "x86,x64" you can change it from the CPU option of the visual studio
or choose any CPU hence the install .net x framework should be compatible with the windows
The target framework for the project
(check the project target framework "right-click on the project and check target framework") if it is 5 so the enabled in the third parameter should be 5 or change this one but take care you should tell the other team members if you change it
The Enabled framework go for tools and get tools and go for individuals component and chose the target framework the same as found in step 2 and press modify
Faced this issue during xUnit testing. Downgrading nuget package "Microsoft.NET.Test.Sdk" to 15.9.0 worked for me
I got this error because of a Project reference pointing to a project, that did not exist anymore (was removed in merged git-commit). Solved it by right-clicking the project, then Edit Project File, delete the reference and save.
I was trying to run a project that used net core 2.2 but I didn't have it, and there was no error(I had 1.1), so after installing the 2.2 using the "Visual Studio Installer" it worked like a charm. =)
I restarted my Visual Studio instance in Admin mode and I was able to debug.
After closing Visual Studio I can now start in normal mode and debug as expected. I'm not sure what changed though.
I was missing a reference to AWSSDK.Core. After installing the specific version and re-starting VS2019 and rebuilding, the project ran fine.
All of a sudden it stopped working. For me clean solution and re-build solution worked.
I was getting a similar error with my project: The target process exited without raising a CoreCLR started event.
My startup project was targeting multiple frameworks: netstandard2.0;netcoreapp2.2
I fixed this issue by changing my target framework from netstandard2.0 to netcoreapp2.2 using the following stackoverflow directions: How to switch between target frameworks for .NET Core projects in Visual Studio
Be sure to install the exact version of .net core that you want your project to run on
I had this issue and finally tracked it down to doing a "publish" operation with a deployment mode of: "Self contained" That resulted in dropping all .NET runtime binaries in my bin directory. Where I think things got totally messed up is I have several solutions all using that same common bin directory, each build different exe's and dll's.
Only one was for a self contained deployment as a test. I think that started mixing up some of the minor dlls for the .NET core and causing this issue. Once I purged all the dll's that were "not mine" and rebuilt things started working again. I'm using Visual Studio 2019 16.8.2 / .NET Core 3.1
I realize the original question is regarding .NET Core 2.2 but this question comes up first when searching for the main issue.
.Net Core 2.2 is required to be installed. I fixed when I added this in Visual Studio Installer.
VS2019 16.7.1 ASP.Net Core 3.1
Our Nunit test projects that issued this error, only worked with a very select set of Nunit and Microsoft packages.
Microsoft.NET.Test.sdk - 16.5
Nunit - 3.12
Nunit3TestAdapter 3.16.1
But here's the catch, you have to go into
c:\users\yourname\.nuget\packages and look for all three folders shown above. If you find any other version in those folders, delete it.
I found two versions in the Microsoft.NET.Test.SDK folder. I suspect the newer version was being loaded. Why? Because when I deleted it everything ran fine.
A corrupt layout is also possible, had this happen myself. To fix, go to projpath\bin\x64\configtype\AppX, for example:
C:\Users\Foo\Documents\Visual Studio 2019\projectname\bin\x64\Debug\AppX
Delete everything here, rebuild and you're good to go.
Since I don't see it here yet, here's what worked for me. I have a UWP project, Win32 project, and Windows application packaging project in the same solution. Running the Win32 app using FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync was giving this message and not working.
What fixed it was changing a setting in the packaging project's project settings:
Debug -> Debugger type -> Background task process: Native Only
I had same issue. Now in VS2022 you cannot download NetCore2.2.
So just download and install NetCore 2.2 from microsoft dotnet website.
https://dotnet.microsoft.com/en-us/download/dotnet/2.2
This error occurred when I tried changing C# projects in my solution to use Docker and running it:
The error went away when I changed the C# projects back to use the Visual Studio's debug server and running it:
In the Test Explorer window of Visual Studio 2019, make sure that there are no references to any *.testsettings or *.runsettings files if you are not using them intentionally. I had referenced a *.testsettings file unintentionally, and that was causing the issue.
For me, I'd just installed Visual Studio 2022 on a fresh installation of Windows 11. My project uses .Net 5, which wasn't installed by default (I only had .Net 6). I simply used the Visual Studio installer, modified my VS2022, selected Individual Components, and enabled .Net 5. Viola!
I started to get this error after updating Visual Studio from 2019 to 2022. It turned out that the project target framework was set to .Net Core 3.1, which was removed when I uninstalled VS2019, and the solution was to change it to .Net 6.0 which is the component I had selected during installation (Installing .Net Core 3.1 from the Visual Studio Installer should work as well).
To do so, right click on the project name and look for the "Target framework" option (my installation is in Spanish so that's what I presume it should say).
I've encountered this issue multiple times, using VS 2017 and VS 2019 across .NET Core 2.1, 3.1 and 5.0.
There are many conditions that can cause this problem to occur:
Microsoft Update can install a version of .Net Core at any time, automatically and outside of your awareness and knowledge.
It can also change the installation of any .Net Core SDK version's installed components.
Your version of VS has to be compatible with the version of the .Net Core SDK that you have installed.
You must have all of the following components installed for this error to be resolved/pre-empted for .NET 5.0 (please check the dotnet 5.0 site for the compatibility list by versions).
Microsoft .NET SDK 5.0.408 which includes (the following below) must all be installed and listed in the control panel:
.NET Core 5.0.17 Windows Desktop Runtime,.NET Runtime, Windows Server Hosting, Shared Framework
If any .NET Core 3.1 SDK are installed without your knowledge, you must uninstall it and repair your targeted .net core version's installation.

The Specified SDK "Microsoft.NET.Sdk" was not Found

So I'm using Rider without Visual Studio installed and its working fine for .NET
but for .NET Core I'm getting the error:
Project 'Test2' load failed: Das angegebene SDK "Microsoft.NET.Sdk" wurde nicht gefunden. → (the specified SDK "Microsoft.NET.Sdk" was not found) C:\Users****\RiderProjects\Test2\Test2\Test2.csproj at (0:0)
Project Creating Settings:
The Error when the project is being loaded which fails:
(the blue underline means "the specified SDK "Microsoft.NET.Sdk" was not found")
Rider Toolset and Build Settings:
Installed .Net Core Version:
Rider Version: JetBrains Rider 2018.1.4 Build #RD-181.5550.7
Hope it was detailed enough and you guys can help me to fix this error :)
#alphaaxmet
You're using a custom MSBuild version
Check your MSBuildSDKsPath env. variable, it should be equal to the path with your latest .net core sdk , e.g.: C:\Program Files\dotnet\sdk\2.1.302
Thanks to #Damir Beylkhanov 's and #Jura Gorohovsky 's answer, If you are experiencing The Specified SDK “Microsoft.NET.Sdk” was not Found error and you have installed JetBrains Rider 2019 or JetBrains Rider 2020 and Dot NET Core 3.1 on Windows 10 64 bit, see below instructions on How to Fix that;
You will need to use the MSBuild that comes with Dot NET Core 3.1 instead of the one that is provided by your installed Dot NET Runtime 3.x or 4.x
So here is how to locate and add the MSBuild that is needed for your Rider Jetbreains IDE if you are using Dot NET Core 3.1.
I was working with a Windows 10 64 bit OS and JetBrains Rider 2019.2.3 I do not know if this is How it works for other Windows platforms or previous versions of JetBrains Rider.
For 64 bit based Windows 10, after you install Dot NET Core 3.1 , your MSBuild.dll will be in this path C:\Program Files\dotnet\sdk\3.1.100
You may also consider adding the path C:\Program Files\dotnet\sdk\3.1.100 to your environment variables.
So here is How to do it.
Click Tools → Settings in JetBrains Rider 2019.2.3
Scroll down and locate Build, Execution, Deployment click on it to expand it.
Scroll down and locate Toolset and Build then click on it to open it.
Once you have opened Toolset and Build, find below the option for editing Use MSBuild version and click the Custom button to the right to browse for the MS Build you want to use.
Browse to the path where your Dot NET Core 3.1 is installed and select the MSBuild dll file there. In my case it was this path C:\Program Files\dotnet\sdk\3.1.100.
Once you have selected the MSBuild.dll that installed with your Dot NET Core 3.1, click OK and OK any other open windows then run your Project again. It should work fine now.
See below screenshot for where circled in red to follow through the same process as I did it on my JetBrains Rider IDE. The same screenshot herein also shows the path for MSBuild.dll in my Windows Desktop Computer.
I was getting this error when trying to load projects targetting .NET core (Project Sdk property Microsoft.NET.Sdk). My environment at the time of this issue was as follows:
.NET Core SDK 2.1.103 through 3.1.102 installed
JetBrains Rider 2019.3.4 installed
Visual Studio 2019 Professional 16.4.5 installed
Rider was able to open the project and solution absolutely fine, although VS 2019 kept complaining about missing SDK. This was a solution with 2 projects both with SDK as Microsoft.NET.Sdk. I then opened a solution that had a web project in it in VS 2019 i.e. Microsoft.NET.Sdk.Web. VS 2019 showed a prompt that said that I needed additional workloads to be installed. When I clicked ok, VS Installer launched and automatically selected "ASP.NET and web development" under workloads. After the installation finished, the web project opened fine but the project with Microsoft.NET.Sdk as the SDK continued to complain about missing SDK.
On further research, I came across this github issue where #akshita31 recommended installing .NET core build tools. Following this:
I relaunched VS 2019 installer
Looked under "Other Toolsets" (scroll at the bottom of the installer Workloads tab) and checked ".NET Core cross-platform development" and followed through.
After the installer finished, VS 2019 could open all projects without issues
I had this same error using the build tools docker container which only installs the azure build tools workload - not the netcore build tools required for Microsoft.Net.Sdk projects.
Solution - Modify dockerfile
The fix for me was to add the Component ID Workload for NetCore Build Tools to the dockerfile config
RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache `
--installPath C:\BuildTools `
--add Microsoft.VisualStudio.Workload.AzureBuildTools `
# <append the line below>
--add Microsoft.VisualStudio.Workload.NetCoreBuildTools `

TFS 2013 won't build a .NET Framework 4.6 project

I am trying to get TFS2013 to build a .NET Framework 4.6 C# project on our build servers. I have installed the build tools and the 4.6 .NET Framework out on the build machine. I can see from the build log that the build server is actually targeting the 4.6 .NET Framework.
Earlier I had issues getting the dll references but those were cleaned up by me installing the 4.6 framework. I even tried installing Visual Studio 2015 on the build server and still it won't build.
I have also tried passing the /p:VisualStudioVersion=14.0 parameter. I am kind of running out of ideas or things to try to get this build working.
I figured out what i needed to do.
To let TFS2013 run builds for 4.6 you need to do the following:
Install the 4.6 framework and the Build Tools for 2015.
OR
Install Visual Studio 2015 (which installs the framework and build tools).
Then you can either modify your build template and hard code the build tools for a template. Or the path I choose that was use the argument: /tv:14.0

Categories