Install MSBuild 15 (Microsoft Build tools) without admin rights? - c#

is there any way to install MSBuild 15 on my machine locally without admin rights?
Microsoft's instsaller on https://www.visualstudio.com/downloads/ seems to inevitably ask for admin rights. I've tried looking into the .exe directly with 7zip, but don't think there's much I could manually extract either (looks like the exe is just a web downloader).
Would there by any other way anyone can think of?
--
Why do I need this? I'm developing on a non-admin machine. I could install the NetCore SDK and VSCode withou admin rights, which is great.
For one of my C# projects I'll need MSBuild to compile though (as I'm trying to use WPF/XAML), specifically MSBuild 15 due to the format of my .csproj files.

In case anyone else is trying the same, I managed to do it;
started with Nuget package Microsoft.Build.Runtime, extracted its contents + downloaded all dependent packages into the same folder, plus a few more (several Nuget Build related ones, also available on Nuget).
Had to fiddle a bit with dependencies, environment variables (so my non-admin install of the Net Core SDK would be found) + including build tasks manually etc., but works now. In the end, I was able to use VSCode to compile a WPF application targeting .Net 4.6.1 that references a few other NetStandard 2.0 projects.

Related

Published .Net Core App Warns to Install .Net Core but it's Already Installed

I made a WPF and Console application for someone to use on their private server which I can't have access to. I used Visual Studio 2019's built-in "Publishing Wizard" to create Framework Dependant single-file apps. When the person opened the WPF app they were greeted with the standard warning:
They clicked yes and to my understanding, they installed .Net Core 3.1 which is what the applications target.
After they restarted the computer they got the exact same warning again. I wasn't sure what was going on so I repackaged the apps as self-contained since the installed version of .Net Core was the same as what my applications were targeting.
That seemed to work for a little bit. We ran into some unrelated issues that I had to fix in the code on my end and then I re-published the projects and sent them out.
They tried to use the WPF application and they got the install warning again.
Now no matter what combination of options I pick in the "Publish Wizard" they keep getting the warning.
I'm not sure what to do.
Here's a picture of my publish settings
In my case I had the same issue, and the problem was that I was not deploying the file "MY_PROGRAM_NAME.runtimeconfig.json". After copying this file, which is present in the build output, the application is launched without problems.
Turns out the issue was the fact that the applications were targeting win-x86 and the user only had access to 64-bit runtimes of .Net Core.
For some reason, I thought it would be able to handle a 32-bit version even if it was running 64-bit runtimes.
I guess live and learn.

How to package .NET Core 3 in Visual Studio Installer Project

So, I want to create an installer for my .NET Core 3 based C# project. I installed the Installer Projects extension for Visual Studio 2019 and created a new Installer project within my solution. After some trying around with different settings, I ended up with adding PublishItemsOutputGroup for my two executables to the Application Folder.
This (throwing various warnings for duplicate dlls) creates a nice installer package with "supposedly" all required dlls (there are quite a lot of .net libs). However, upon executing one of the installed exe files on a target computer, I am getting:
It was not possible to find any compatible framework version
The specified framework 'Microsoft.NETCore.App', version '3.0.0' was not found.
- Check application dependencies and target a framework version installed at:
C:\Program Files\dotnet
- Installing .NET Core prerequisites might help resolve this problem:
https://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
- The .NET Core framework and SDK can be installed from:
https://aka.ms/dotnet-download
- The following versions are installed:
2.2.7 at [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
I know, I could create a gigantic self-contained .exe when publishing the .exe files, however, that seems kind of wasteful to me - creating two gigantic .exe files that contain mostly the same .dlls anyways.
Is there no way to include a .NET Core 3 setup in the installer project as well? I can't find anything on that topic on the internet...
I found this as had same problem, but eventually worked out if you set the publishProfilePath setting in the Installer Project it will include all the files and works fine.
For me replacing PrimaryOutput with PublishItemsOutputGroup works fine, when it comes to gathering the dependencies.
Unfortunately it does not allow referencing those outputs inside the installer. E.g. if you want to run custom actions or create Shortcuts during the installation, it does not work. The outputs are not available.

Visual Studio 2017 - Potentially unneeded dlls in release folder

i'm trying to obtain an executable file with only the necessary dlls in the release folder, unfortunately VS is putting in that folder even System dlls, that afaik are not supposed to be redistributed with the executable.
I'd like to know if there's a way to make VS add to the release folder only dlls the executable can not work without, the ones that are supposed to be redistributed.
Thank you.
Release folder:
These assemblies are shims for .Net Standard where the full framework had gaps. Based on the assemblies in that folder, I assume that your exe is targeting .net 4.6.x and you are consuming a .net standard library.
If you upgrade to .net 4.7.2 you will see the number of required System.* assemblies reduced greatly.
See this answer for more details: Why does my .NET Standard NuGet package trigger so many dependencies?
I'm assuming this is a dotnet core project. Use the "dotnet publish" command to create your deployment files (the screenshot looks like a VS build directory?). You might see more dlls than you're used too if you're coming to dotnet core from using the Windows frameworks previously, but it depends on the publish options you use.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish

Make C++ runtime available for Elastic Beanstalk deployment

I plan to publish my ASP.NET 4.5 application on Amazon Elastic Beanstalk. I have a library ImageMagick.NET that dependent on the Visual C++ Redistributable Packages.
I can't manually install the packages because I deploy the app from within Visual Studio and the servers will auto-scale based on the code that I have.
I want to install the Visual C++ Redistributable for both x86 and x64 so my app can work as intendent.
Right now I get the error:
ould not load file or assembly 'Magick.NET-x86.DLL' or one of its dependencies. The specified module could not be found.
That's because I didn't have the packages installed on the server (asked this question earlier).
So from my understanding, I need a way for the packages to be pre-installed, probably either supplying dll's to the bin folder with the merge modules, or initialize an installer from within the project that will launch the package installer after the project is deployed on Elastic Beanstalk.
I need a way to have those packages installed automatically so the ImageMagick.NET dll can work. Thanks.
update: their might be a way to do it with configuration files.
The right way is to use Elastic Beanstalk Configuration files.
These are YAML files, where you can add commands (in the specified format) and upload along with your application package. You could do things like creating files, installing libraries etc. Most of the command line (headless) doable stuff could be handled here.
Customizing the Software on EC2 Instances Running Windows - AWS Elastic Beanstalk : http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-windows-ec2.html
Each time you deploy a new version or re-start the servers, these scripts execute and you can achieve pretty much any customisation.

Setting up a Build machine with TeamCity

I'm currently dealing with multiple small-time dev projects at work.
I'd like to formalize the proecss and so i've installed TeamCity which was recommended by many and is also free for small projects.
I'd like to know -- which components are needed to build projects on a build agent machine ?
I'm building C# projects; do i need to install VS2010 on every build machine? only some subset of it? what exactly ?
Only the .Net framework ( which includes msbuild ) should be enough. No need, and it is probably not a good idea in most cases, to install Visual Studio on build agents. Keep the installed stuff on build agent to bare minimum needed to build.
Installing .NET and the Windows SDK (the .NET parts) should be sufficient. Depending on the project types you are using, it will be necessary to copy build targets from your local machine to the build agents (but this is a one time configuration).
You just need to install the framework 4.0 you don't need the all VS2010.
Maybe it's a web project and you use the Web Deployment Pakage so you will need to install this package: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=89f2c4f5-5d3a-49b6-bcad-f776c6edfa63&displaylang=en
Hope this helps.

Categories

Resources