I have a website project and some other projects that are tied up via a solution file. When I build the solution using visual studio, it does not create precompiled version of website but using msbuild to build the solution creates precompiled version.
We don't use precompiled code to deploy on servers so this version is not required in our process.
And this takes a lot of time to get created.
So how can I avoid creation of pre compiled version? Is there any switch or task that I can use in msbuild scripts to build the solution.
I need msbuild to simply build the solution.
currently the command that I am using is:
msbuild "ABC.sln"
MSBuild on the command line features a /t switch, which allows you to define build targets. You would use this switch to target all the other subfolders in the solution, leaving the website untouched.
MSBuild Command Line arguments on MSDN
Related
I have a ASP .NET CORE application, targeted in verion 6.0.
When I run it from Visual Studio it looks great, but when I run it using dotnet command:
dotnet webApplication1.dll
it looks like no .css styles or .js scripts where found and used.
I searched this documentation but cannot find the hint how to include styles path.
I think you are using the wrong command
You should use.
dotnet run
If you want to use the dotnet command you should publish you app before in order to have all the misc files.
You need to do :
dotnet publish
Before running the app using
dotnet Webapp.dll
I solved it by manually copying wwwroot folder to the \bin\Debug\net6.0 directory. For some reasons it is not being copied there automatically.
I've a legacy project, which is a ASP.net Website project(not having .csproj file). It holding .aspx files and packages.config for nuget and other dependencies. Now I want to deploy it to Azure app service by automation with CI/CD in Azure Dev Ops pipeline.
I can't find anything which is suitable for all tasks I need for CI.
Here I don't have .csproj, so I build it using packages.config
Task I tried
Update .sln to .config, because I have more than one website in single solution.
Update Nuget Restore task with install, it doesn't work with restore
And while queue, this pipeline got failed on Build task
Error it thrown
Visual Studio Build task cannot build packages.config file, this task uses MSBuild to build. In Solution argument, only .sln file or .*proj file can be specified.
Solution: Required) If you want to build a single solution, click the
... button and select the solution.
If you want to build multiple solutions, specify search criteria. You
can use a single-folder wildcard (*) and recursive wildcards (**).
For example, **.sln searches for all .sln files in all
subdirectories.
You can also build MSBuild project (.*proj) files. If you are building
a customized MSBuild project file, we recommend you use the MSBuild
task instead of the Visual Studio Build task.
Default value: ***.sln
Is there an obfuscation tool that can work well on the exe and pdb files that result from a dotnet core single file publish?
I am using dotnet core single file publish with the command: dotnet publish -r win-x64 -c Release /p:PublishSingleFile=true. This works great in giving me just two neat files an exe and a pdb file, which I am able to give to a client to run my application.
However, I am still concerned about its ability to be decompiled.
I tried using ILSpy and JustCompile on both the files and they luckily could not be decompiled with these tools. Is it then that my files are safe, or it is that the tools have not yet caught up?
If the latter, what obfuscation tool can I use to protect these files? I attempted to use Obfuscar which did not work specifically on the single file publish outputs, the exe and pdb.
Any suggestions on the obfuscation tools to use for this?
Disclosure: I work for the Dotfuscator team at PreEmptive.
We have tested and verified that Dotfuscator Professional handles this scenario on both .NET Core 3 and .NET 5.
Specifically, you must use Dotfuscator Professional's MSBuild integration, which is now our recommended method of using Dotfuscator Professional for new projects. However, Dotfuscator will not update .pdb files on .NET Core or .NET 5, so you will not be able to debug builds which use Dotfuscator (e.g., Release builds). You should not ship .pdb files to untrusted users.
You can decompile .NET Core self-contained executables if you manually unpack them:
Can .Net Core 3 self-contained single executable be decompiled?
You would have to run the obfuscator as part of the build process, before the individual assemblies are compressed into the single file. That's probably possible if you add a custom MSBuild target that executes the obfuscator, and use the BeforeTargets attribute to integrate it at the correct point in the build process. But I haven't looked at the .NET core build system in detail.
You can use Obfuscar.
Use it in obj directory after target Compile and then copy obfuscated files to directory.(replace with original files)
I tried to switch from Visual Studio to Visual Studio Code with my CORE project. I can build the C# project in Visual Studio without any problems. When I tried VSCode, I see that I need to define tasks. Fortunately, VSCode offers default tasks definition (it generates tasks.json) for me, so I tried them (there are variants for CORE and .NET, as I understand). But both don't work. I tried to make build from command line, but get error (I translate the error to English, it's not original text):
C:\Program Files\dotnet\sdk\2.1.700\Microsoft.Common.CurrentVersion.targets(3046,5): error MSB4216: can not execute task "GenerateResource", because MSBuild cannot create tasks server with execution environment "CLR4" and architecture "x86" or to connect to it. Verify that, (1) required execution environment and architecture do exist and (2) required executable file "C:\Program Files\dotnet\sdk\2.1.700\MSBuild.exe" exists and can be ran. [D:\prj\...\Test.csproj]
and when I tried to find MSBuild.exe in this folder, I found MSBuild.dll only, no any MSBuild.exe. So, I tried to run it with dotnet after entering this folder - it works. But if I try to call dotnet build or to run it with full path to MSBuild.dll from my project folder, I always get this error. Seems, that dotnet command calls MSBuild.dll multiple times and always hit this problem. May be I should setup some paths or similar. But where to do it (without to break ability to build the project in Visual Studio)? What is the convenient way to build CORE projects in Visual Studio Code? How to build them in command line?
PS. May be all documentation which I found was outdated...
While learning continuous integration, i come across both of these terms. And i got confused. May be it is a very silly question. But i want to know in continuous integration process what are the role of MsBuild.exe and MsDeploy.exe. Can i use one over other. Or do they have there own purpose.
I have also tried to use both options but while using them i got following error on server request timeout for "www.serverurl/MsDeployAgentService"
Should i use www.serverurl.com/msbuild.axd or www.serverurl.com/MsDeployAgentService.
As far as i understand, they both build and publish application with config transform.
Please help me out.
You can't build using msdeploy, but you can build and deploy using msbuild or you can build with msbuild and deploy with msdeploy
MSBuild is a hierarchical target-based build system. It's intent it to run general purpose tasks related to building an application, and is primarily focused around compilation. Visual Studio uses this when you build your project.
MSDeploy (or Microsoft Web Deploy) is a CLI and library for deploying files (and other configuration) between servers. It handles concepts like authentication, skipping files and environment-specific parameters. Visual Studio uses this when you select "Publish".