Building Serverless Applications in Azure.Azure Container Instances: Getting Started.Microsoft Azure Developer: Implement Azure Functions (AZ-204).Versioning and Evolving Microservices in ASP.NET Core.Microservices Architecture: Executive Briefing.Microsoft Azure Developer: Deploying and Managing Containers.
csproj file format makes it really easy to develop NuGet packages that multi-target several frameworks, but you will likely occasionally need to use the conditional syntax to make this work. NET 3.5 target, I'm referencing the assembly, and excluding three specific files from being compiled: For example, here's how in NAudio for the. Sometimes you might want to exclude some C# files from being compiled for a certain target. I'm also showing here how you can use multiple conditions, so we'll reference this whether we're targeting. If it was a NuGet package you wanted to conditionally reference, that's done in the same way, just using PackageReference instead. Unfortunately, there doesn't seem to be any way of getting Visual Studio to auto-generate this for you, and the conditional syntax can be hard to remember, which is why I've documented it here so I can find it again in the future next time I forget it! To do that, we simply add a conditional reference to our. To fix this we need to add a reference to the System.Web assembly, but it's only needed for the. Return HttpUtility.JavaScriptStringEncode(input) public string JavaScriptEncode(string input) NET 4.6.2 target will fail because it can't find the definition of HttpUtility. One issue you might run into is that you need to reference different assemblies or NuGet packages depending on which target you're building for.įor example, it we add the following method to our library, it will successfully compile the. By the way, I'm using the excellent NuGet Package Explorer utility here to look inside my. If we build this now, we'll get a NuGet package containing separately built DLLs for both targets. Īnother thing you can do, is multi-target more than one framework, which can be useful when you're creating a NuGet package intended to be used on several different versions of. The Visual Studio project properties dialog simplifies setting this up. nuspec file - you can just enable GeneratePackageOnBuild and define any metadata. If you want to create a NuGet package for your library, there's no need for a separate. It doesn't even require you to specify all the C# files to be compiled - it just assumes that all of them are wanted, which cuts down on a lot of noise. NET Standard 2.0, then here's the entirety of the. NET Core tooling is the new csproj file format, which is a lot less verbose.įor example, if you create a brand new C# library project, targeting.